Wednesday, August 11, 2010

How To Reduce Delay Getting SSH Login Prompt

Recently we have installed a new RHEL5.4 machine. Its located just few kilometres from our office. But when I have observed at the time of logging in the shell prompt is taking considerable time to appear(though connection is taking a fraction of second, after entering the password its taking more time). So we did some tweeking and found out this is related to DNS. We have to change dns related entries in ssh config file to reduce this delay.

Note : Be careful when doing this on production servers. This activity may disconnect all the users from the system who are logged in to that machine using SSH

By default UseDNS option in this file is disable. We have to uncommet this option and then edit this entry to no. As below.. 
Just search for UseDNS..

[root@tst ~]#vi /etc/ssh/sshd_config 

before config
#UseDNS yes

After config 
UseDNS no 

save and exit the file and then just reload ssh service to take effect what ever changes we did.. 

#service sshd reload.
Now try to login and observe, delay will be reduced.
Please share your thoughts on this..