Wednesday, June 1, 2011

Open SSH without password

Setting up an SSH key pair:
At Linux server, e.g. localhost

# ssh-keygen -t rsa

Generating public/private rsa key pair...

Enter file in which to save the key (~/.ssh/id_rsa): myid_rsa
Enter passphrase (empty for no passphrase):
Enter same passphrase again:

Your identification has been saved in myid_rsa. [CHMOD must be 600 or 400 ]
Your public key has been saved in myid_rsa.pub.
The key fingerprint is:
xx:xx:xx:xx:xx:... root@hostname
The key randomart image is:
.......
.......
.......

# ssh-copy-id -i myid_rsa <destination-host-IP>

Enter Destination host's Password:

Now try logging into the machine, with "ssh '<destination-host-IP>'", and check in:
.ssh/authorized_keys
to make sure we haven't added extra keys that you weren't expecting.

Now you should able to do SSH without enter the password of destination host:

# ssh -i ~/.ssh/myid_rsa <destination-host-IP>

No comments:

Post a Comment