Thursday, 13 October 2011

SSH Login Without Password

Follow this step from the machine that you want to get access to remote machine

Step 1: Create public and private keys using ssh-key-gen on local-host

patelm@local-host$ [Note: You are on local-host here]
patelm@local-host$ ssh-keygenGenerating public/private rsa key pair.
Enter file in which to save the key (/home/jsmith/.ssh/id_rsa):[Enter key]
Enter passphrase (empty for no passphrase): [Press enter key]
Enter same passphrase again: [Pess enter key]
Your identification has been saved in /home/
patelm/.ssh/id_rsa.Your public key has been saved in /home/patelm/.ssh/
The key fingerprint is:
f3:58:0d:f8:65:d6:8f:95:8B:11:89:1a:e5:d6:b0:64 patelm@local-host
The key's randomart image is:
+--[ RSA 2048]----+
| .E.oo |
| oo.=o+ .|
| . +++o.o.|
| o.* + |
| S o . . .|
| = |
| . . |
| |
| |

Step 2: Copy the public key to remote-host using ssh-copy-id

patelm@local-host$ ssh-copy-id -i ~/.ssh/ remote-host
patelm@remote-host's password:
Now try logging into the machine, with "ssh 'remote-host'", and check in:


to make sure we haven't added extra keys that you weren't expecting.
Note: ssh-copy-id appends the keys to the remote-host’s .ssh/authorized_key.

Step 3: Login to remote-host without entering the password

patelm@local-host$ ssh remote-host
Last login: Sun Nov 16 17:22:33 2008 from
[Note: SSH did not ask for password.]

patelm@remote-host$ [Note: You are on remote-host here]

No comments:

Post a Comment