Login to server takes time

When I am trying to login to a server using Putty ssh from my windows xp machine it is taking too much time for login.

My server name is http2 and when I enter this address into putty I immediately get
login as:
screen, but after I put my username root and enter the cursor moves downwards and wait for sometime(Around 20 seconds) before it displays
root@http2's password:
After I enter password it seems everything works fine and no problem running commands also.

I also encountered this problem with other usernames and only this server on this network have this type of problem. This server also don't have much processes running.

Please check the setting in the nsswitch.conf file in /etc folder

 
passwd:     files
shadow:     files
group:      files
#hosts:     db files nisplus nis dns
hosts:      files dns

contents in the nsswitch.conf file is dumped here. Please check this:

passwd:     files
shadow:     files
group:      files

#hosts:     db files nisplus nis dns
hosts:  files dns

# Example - obey only what nisplus tells us...
#services:   nisplus [NOTFOUND=return] files
#networks:   nisplus [NOTFOUND=return] files
#protocols:  nisplus [NOTFOUND=return] files
#rpc:        nisplus [NOTFOUND=return] files
#ethers:     nisplus [NOTFOUND=return] files
#netmasks:   nisplus [NOTFOUND=return] files

bootparams: nisplus [NOTFOUND=return] files

ethers:     files
netmasks:   files
networks:   files
protocols:  files
rpc:        files
services:   files

netgroup:   nisplus

publickey:  nisplus

automount:  files nisplus
aliases:    files nisplus

Does it go faster when you enter the IP instead of the name of the host when connecting?
Is the box you are trying to connect to very busy? Check with vmstat or top .

Using IP address also the same delay occurs.

This server is working ideal and not many processes are running.

Is any other type of connect to the server fast ie. by it's name it sounds like being a webserver - is a http-connect fast? ftp?
Is it in the same subnet as your workstation you are trying to connect from?
Is a traceroute showing any delays?

ftp and http-connect are working fine and fast.

This problem only exists when login to the server. But once logged into the system there is not problem for running tasks and commands and all are working fast.

after you login create a .hushlogin file in home dir

touch .hushlogin

Usually creating a ".hushlogin" file in your home directory will disable the quota checks.

I executed the command you said and the result is same.

Is this the case no matter from where you login? Do you have another box you could try to login from? If the problem persists, maybe restart the sshd. If this also does not help you could issue your ssh client with -v , -vv , or -vvv to get debugging output.

1 Like

That solved the problem. I don't know what is the actual problem, but login from another PC works fine. But this problem only happens in this server only. Other servers can be login from my PC fast and without any delay.

Thank you for help. Please answer me if you know what is the problem with my PC and server.

Maybe update your sshd if it is an old version or downgrade if it only happens with a new version etc.
You could also compare /etc/ssh/sshd_config of this and a working server as a start.

Edit:
If you are using PAM, maybe some module takes some time. Check if your OS offers any tracing of this.

1 Like

Have u tried rebooting?? I faced a similar issue where ping, traceroute, and everything was fine. After restart it was normal.

Can you please share the content of /etc/resolve.conf file. Thanks!

You can check the dns server entry in /etc/resolve.conf file . If the dns ip is not reachable then its getting delayed. If you are not using dns then just comment out the enrties in that file.