1. Introduction

Usually when you run rsync or just connect a lot to a remote machine running SSH you'd like to avoid entering the password each time. This is especially good for automatic scripts.
However, you shold note that the security aspect here is very dangerous. If someone will have your local client computer, then he will have access to the remote one.
You should have SSH access in the first place. You will need to enter the password to in order to setup the password-less connection.

2. Diagram
client server diagram

3. Configuration

First create an identify or SSH Key on your own machine (the local/client machine)

# ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/root/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_dsa.
Your public key has been saved in /root/.ssh/id_dsa.pub.
The key fingerprint is:
e4:83:ea:54:c5:c2:da:ca:98:60:e8:cv:4a:5a:ba:da root@linux-example
The key's randomart image is:
+--[ DSA 1024]----+
|                 |
|             .   |
|          . . E  |
|         . o     |
|   . . .S .      |
|    o.=+o.       |
|    .+o+oo .     |
|    .. +oo+      |
|   .o.  ++o      |

Now go to the location where you've created the new public key of your local machine.

# cd ~/.ssh

The following will push the created key onto the remote macine into it's user_dir/.ssh/authorized_keys file. In the example we use root user.
I advice you not to user this for root user, but only for specific login users.

# cat id_dsa.pub | ssh root@ 'cat - >> ~/.ssh/authorized_keys'
root@'s password:

Notice we've entered the password here.

4. Verification

Verify you're in that file. You can see each line in the file that ends with the hostname of the client/ local machine . Search for your client. In our example it's linux-example.
# ssh root@ cat ~/.ssh/authorized_keys
ssh-dss AAAAB3NzaC1kcuk/+R/AVgV6TEf21K9E3MzQRvFFvvzxcvImWrEt+MsAd9WJ+Yj4= root@linux-abcd
ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIB8NFFvvzxcvImWrEt+MsTwrTVNx8KZwzNj067== nextdaa
ssh-dss AAAAB3NMZ1asdfasdfasdfFaSddWWqqFFvvzxcvImWrEt+Ms/xICPTjF0tgIo/49b1dffjfbr3u== root@linux-example

You should notice that this time, you weren't asked for a password!

5. In short

# ssh-keygen -t dsa
# cd ~/.ssh
# cat id_dsa.pub | ssh remote-machine 'cat - >> ~/.ssh/authorized_keys' -l root

Viewed 25400 times.
Share |
How to migrate from o... (Daniel, 16:52 06/04/2013)
How to redirect SNMP ... (Daniel, 18:32 24/08/2012)
How to add httpd.conf... (Daniel, 19:20 24/03/2012)
How to avoid entering... (Daniel, 03:11 27/12/2011)
How to configure SOFT... (Daniel, 23:24 26/12/2011)
Subversion - Tortoise... (21:02 17/01/2010, 119405 views)
How to install Nagios... (01:08 23/12/2011, 44711 views)
Byte Order Mark (BOM)... (17:36 22/02/2010, 28357 views)
How to avoid entering... (03:11 27/12/2011, 25400 views)
Raid Types (17:54 09/02/2010, 20976 views)