Wednesday, September 10, 2014

SSH Login without password!

On server 1 
ssh-keygen -t rsa
Leave password blank

Generating public/private rsa key pair.
Enter file in which to save the key (/home/root/.ssh/id_rsa): 
Created directory '/home/root/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/root/.ssh/id_rsa.
Your public key has been saved in /home/root/.ssh/id_rsa.pub.
The key fingerprint is:
XXXXXXX

SSH to server 2 and make directory
ssh root@server2 mkdir -p .ssh

Cat your server 1 key to there
cat .ssh/id_rsa.pub | ssh root@server2 'cat >> .ssh/authorized_keys'

To test on server 1
ssh root@server2

No comments: