首页 » 系统相关 » Troutbleshooting ssh connect HPUX 11.31 slow

Troutbleshooting ssh connect HPUX 11.31 slow

Recently, I encountered a customer who needed more 20 seconds to login to the database server Hpux operating system through ssh, while the other one was normal. He consulted me and recorded the analysis method below.

If you are experiencing slow logins on HPUX, here are a couple of things to try:
Edit the file /opt/ssh/etc/sshd_config and change “#UseDNS yes” to “UseDNS no” NOTICE the “#” sign was removed from the beginning of the line to uncomment the configuration parameter.

cat /etc/nsswitch.conf
hosts: files [NOTFOUND=continue UNAVAIL=continue] dns
ipnodes: files [NOTFOUND=continue UNAVAIL=continue] dns

If that doesn’t help, try zero’ing out the following files by running these commands:

> /var/adm/wtmp
 > /var/adm/wtmps
 > /var/adm/btmp
 > /var/adm/btmps
 
 the ">" at the beginning of the line is required and redirects NULL to the file, thus zero'ing out the file.

This case is because the wtmps file is nearly 1G, which can be solved by clearing the log.

File btmps contains bad login entries for each invalid logon attempt. File wtmps contains a record for all logins and logouts apart from accounting records.

wtmp file is binary, and must be processed by the commands on the system.Reading wtmps file,

If you want to try the last command, the following extracts most out of the files:

last -Rf /var/adm/wtmp
last -XxRf /var/adm/wtmps

a shell

if [ ${OS_VERSION} = "B.11.11" ]; then
    for file in $(ls -1 /var/adm/wtmp.*|grep -v gz)
    do
      /usr/sbin/acct/fwtmp -X < ${file} >> ${REPORTDIR}/successful-logins-all
    done
    if [ -f /var/adm/wtmp ]; then 
      /usr/sbin/acct/fwtmp -X < /var/adm/wtmp >> ${REPORTDIR}/successful-logins-all
    fi
  else
    for file in $(ls -1 /var/adm/wtmps.*|grep -v gz)
    do
      /usr/sbin/acct/fwtmp -X < ${file} >> ${REPORTDIR}/successful-logins-all
    done
    if [ -f /var/adm/wtmps ]; then 
      /usr/sbin/acct/fwtmp -X < /var/adm/wtmps >> ${REPORTDIR}/successful-logins-all
    fi
  fi
打赏

目前这篇文章还没有评论(Rss)

我要评论