Speed Up SSH Connections in Ubuntu


Open ssh connection usually takes 10-20 seconds and will immediately be asked a password, but if more than 20 seconds is usually no problem in the configuration in the file /etc/nsswitch.conf. to speed up the ssh connection is open, we directly edit files in  

/etc/nsswitch.conf go to terminal and type this command:

$ sudo su
$ gedit /etc/nsswitch.conf

...
# Change this line
# hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
# To this (removed mdns4)hosts: files mdns4_minimal [NOTFOUND=return] dns
...


Configuration for sshd to not rDNS look up

$ echo "UseDNS no" >> /etc/ssh/sshd_config
$ /etc/init.d/ssh restart

Add the client machines on the server machine by type :

$ echo "[your_client_ip] [your_client_hostname]" >> /etc/hosts

Debugging ssh

$ tail -f /var/log/auth.log
$ ssh -vvv [normal connection string]

Finish and Happy Testing...!!

No comments:

Post a Comment

Please Comment...!!