Saturday, February 16, 2008

Generate host key for inter-host SSH

You will find it handy to let the hosts communication each other and transfer files using SSH or SCP, but you don't want to allow Password Authentication to prevent password brute force attacks. You can generate the key pairs and allow key authentication with the following steps:

1. Make sure OpenSSH is installed
2. Check if you have directory $HOME/.ssh
3. ssh-keygen -t rsa, then it will generate the public (id_rsa.pub) and private (id_rsa) key files in $HOME/.ssh. Copy the id_rsa.pub content to the remote host $HOST/.ssh/authorized_keys2 file

To disable Password Authentication:
vi /etc/ssh/sshd_config
PasswordAuthentication no # Default is yes

/etc/init.d/sshd restart

No comments: