Wednesday, February 9, 2011

[Level2] authorized key for ssh.

If you want to pre-authorized key for ssh loging (without password prompt),
please try the following steps:

1. Create key
stanley@s1$ echo "y" > /tmp/y
stanley@s1$ ssh-keygen -f ~/.ssh/id_rsa -N"" < /tmp/y
2. Verify public key
stanley@s1$ ssh-keygen -f ~/.ssh/id_rsa -y 
3. Copy public key to remote server
stanley@s1$ ssh stanley@s2 echo `cat .ssh/id_rsa.pub` \>\> ~stanley/.ssh/authorized_keys
or
stanley@s1$ ssh-copy-id -i ~stanley/.ssh/id_rsa.pub stanley@s2
4. Test
stanley@s1$ ssh stanley@s2
The authenticity of host 's1 (192.168.1.1)' can't be established.
RSA key fingerprint is xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx.
Are you sure you want to continue connecting (yes/no)? yes
stanley@s2$ exit
stanley@s1$ ssh stanley@s2
stanley@s2$


Wish this helps.
regards,
Stanley Huang