How to use public-key ssh authentication
- by Poma
I have 2 ubuntu 12.04 (beta) servers (node1 and node2) and want to establish passwordless root access between them. Other users should not have access to other boxes. Also note that ssh default port is changed to 220.
Here's what I did:
sudo -i
cd /root/.ssh
ssh-keygen -t rsa # with default name and empty password
cat id_rsa.pub > authorized_keys
then copied id_rsa & id_rsa.pub to node2 and added id_rsa.pub to authorized_keys. Both hosts have the same /root/.ssh/config file:
Host node1
Hostname 1.2.3.4
Port 220
IdentityFile /root/.ssh/id_rsa
Host node2
Hostname 5.6.7.8
Port 220
IdentityFile /root/.ssh/id_rsa
Now the problem is that when I type ssh node2 it asks me for password. What may be the problem?