Thursday 8 August 2013

How to perform SSH login without password

You can login to a remote Linux server without entering password using ssky-keygen and ssh-copy-id.

ssh-keygen creates the public and private keys. ssh-copy-id copies the local-host’s public key to the remote-host’s authorized_keys file. ssh-copy-id also assigns proper permission to the remote-host’s home, ~/.ssh, and ~/.ssh/authorized_keys.

Note: ssh-copy-id appends the keys to the remote-host’s .ssh/authorized_key.
root@manoj-1:~$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/manoj/.ssh/id_rsa): /home/manoj/.ssh/id_rsa1
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/manoj/.ssh/id_rsa1.
Your public key has been saved in /home/manoj/.ssh/
The key fingerprint is:
52:ce:f5:ad:20:38:b5:de:24:e4:af:6c:53:62:07:29 manoj@root-1
The key’s randomart image is:
+–[ RSA 2048]—-+
|                 |
|                 |
|        +..      |
|      EOoo . .   |
|      +.S.o . .  |
|       +o*o. .   |
|       ..+o .    |
|       .o.       |
|       .o.       |
root@manoj1:~$ ssh-copy-id -i ~/.ssh/ root@
root@ password:
Now try logging into the machine, with “ssh root@”, and check in:
to make sure we haven’t added extra keys that you weren’t expecting.

Now, try to login to a remote server without password.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.