LinuxMoz

Linux Stuff && Coffee

SSH Passwordless Login

| Comments

How to setup SSH Passwordless login using SSH key phrases, this is required for tasks such as Rsync Backup or being able to transfer files from one box to another without entering authentication credentials.

How to setup SSH keys without a login password

On your Linux box enter:

1
ssh-keygen -t rsa

Accept the default options and push enter when it asks you for a passphrase:

1
2
3
4
5
6
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.

You should now have a public and private key in ~.ssh we need to copy the public key (never give out your private key!) to the server we wish to access via our SSH passwordless login setup:

1
ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected]

You will then get prompted for the password on the remote server, enter it and ssh-copy-id will copy your key over and install it with the correct permissions.

You should now be able to login via SSH without a password with:


You should automatically login and not have to enter a password, if not you probably made a mistake go back and retrace your steps.

Comments