Improving security for SSH
There are two things to increase the security for ssh logins.
Change SSH Port
To change the SSH port, simply edit the sshd_config file with the commmandsudo nano /etc/ssh/sshd_config
and change the line Port 22
to something higher. Make sure to stay below 65,000 and don’t use any port which is already used by another service like 80 (web). After changing and saving the file, simply restart the ssh daemon and reload the configuration with sudo /etc/init.d/ssh reload
. Done.
Disable password based login for SSH
To disable the password based login for all the users, you can do the following:# Open the sshd config file
sudo nano /etc/ssh/sshd_config
ChallengeResponseAuthentication no
RSAAuthentication yes
PubkeyAuthentication yes
/etc/init.d/sshd restart