Categories
Freebsd

Passwordless ssh login with keys

Create a key with no passphrase on the source machine

[install@source ~]$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/install/.ssh/id_rsa):
Created directory ‘/home/install/.ssh’.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/install/.ssh/id_rsa.
Your public key has been saved in /home/install/.ssh/id_rsa.pub.
The key fingerprint is:
66:c1:3f:95:c6:a9:d6:99:49:bf:a0:57:4f:a3:78:49 install@localhost.localdomain

Copy it to the destination machine…

[install@source ~]$ scp id_rsa.pub 10.50.2.50:~

On the destination machine create the .ssh directory and copy the id_rsa.pub to authorized_keys. If you have multiple keys you can just append it, something like this “cat id_rsa.pub >> authorized_keys”

[install@destination ~]$ mkdir .ssh
[install@destination ~]$ chmod 700 .ssh
[install@destination ~]$ cp id_rsa.pub .ssh/authorized_keys

Now you should be able to login…

[install@source .ssh]$ ssh 10.50.2.50
Last login: Fri Sep  5 14:18:01 2008 from 10.50.2.51
[install@destination ~]$

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.