ow 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.
Eg:
root@ranjan:~$ 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/id_rsa1.pub.
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@ranjan:~$ ssh-copy-id -i ~/.ssh/id_rsa.pub root@11.122.112.13
root@11.22.33.44?s password:
Now try logging into the machine, with “ssh root@11.122.112.13?”, and check in:
.ssh/authorized_keys
to make sure we haven’t added extra keys that you weren’t expecting.

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

Advertisements
Leave a comment

Leave your opinion

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: