Password Less Login SSH – CentOS 6 / RHEL 6

SSH is a client and serer protocol, that help us to access the remote system over the network through the encrypted tunnel. Whenever the client access the server, the client downloads the secure key from the server and at the same time server also downloads key from client. Those two keys make the encrypted tunnel between the server and client, so that data transfers very securely over the network.

SSH is widely used as the alternative of FTP, as you know any thing that uses TCP network asks password to collect data. SSH is also a TCP service, it requires password to access the remote machine. If the organization has a large no servers, every time admin has to enter the password to access the remote system. It is a pain to enter the password multiple times, SSH comes with new feature called password less login, that help you to access the remote machine without entering the password.

To enable the password less login,we have to put the public key entry of client host name and user detail on the remote server. That key entry will be on the following file (~/.ssh/authorized.keys) (~=Home directory of the user) according to your remote user.

Follow the steps to create the password less login. here we have two machines with two different username.

 server.example.com    ram 
 client.example..com    raj 

Now i logged in as raj on client.example.com, create pair of keys by using following command.

[raj@client ~]$ ssh-keygen

Generating public/private rsa key pair.

Enter file in which to save the key (/home/raj/.ssh/id_rsa):

Created directory ‘/home/raj/.ssh’.



Enter passphrase (empty for no passphrase):  Enter



Enter same passphrase again: Enter



Your identification has been saved in /home/raj/.ssh/id_rsa.

Your public key has been saved in /home/raj/.ssh/id_rsa.pub.

The key fingerprint is:

4d:b7:fd:54:d6:0c:ad:87:b0:ec:13:47:96:d5:34:e4 raj@client.example.com

Once you have created, you will find two files inside the .ssh directory. id_rsa and id_rsa.pub. We are going to use id_rsa.pub as a base file.

[raj@client ~]$ cd .ssh/[raj@client .ssh]$ ll

total 8

-rw——- 1 raj raj 1675 Jan 24 02:57 id_rsa

-rw-r–r– 1 raj raj 404 Jan 24 02:57 id_rsa.pub

Use the ssh-copy-id command with input file of id_rsa.pub; it creates ~/.ssh/authorized.keys if not present, other wise it appends the key. The key contains the information about the host and user name.

[raj@client .ssh]$ ssh-copy-id -i id_rsa.pub ram@server.example.com

The authenticity of host ‘srv01.linuxhow.in (10.65.4.55)’ can’t be established.

RSA key fingerprint is ff:67:e7:b2:ae:ff:42:a6:f5:de:ef:54:3c:95:90:09.



Are you sure you want to continue connecting (yes/no)? yes



Warning: Permanently added ‘server.example.com,10.65.4.55’ (RSA) to the list of known hosts.

ram@server.example.com’s password: ***** [Type password of remote user RAM]

Now try logging into the machine, with “ssh ‘ram@server.example.com'”, and check in:

.ssh/authorized_keys

to make sure we haven’t added extra keys that you weren’t expecting.

Now access the remote machine using SSH. It will take you to the shell directly without asking password.

[raj@client .ssh]$ ssh ram@server.example.comLast login: Sat Dec 4 11:21:06 2013 from 10.65.4.20

[ram@server]$

That’s All, This password less login saves the time and energy of the system admin.

 

Search Term:

Password Less Login SSH, Password Less Login SSH Linux, Password Less Login SSH CentOS, Password Less Login SSH CentOS 5, Password Less Login SSH CentOS 6, Password Less Login SSH RHEL, Password Less Login SSH RHEL 5, Password Less Login SSH RHEL 6, Password Less Login SSH Fedora, Password Less Login SSH Fedora 18, Password Less Login SSH Fedora 17, logging in SSH Without Password Linux, logging in SSH Without Password RHEL 6, logging in SSH Without Password CentOS 6,logging in SSH Without Password RHEL, logging in SSH Without Password CentOS, logging in SSH Without Password Ubuntu, logging in SSH Without Password Fedora

POSTS YOU MAY LIKE -:)

Share This Post

  • Alex

    Great tutorial. Thanks a lot!!!

  • brad_aaa

    It works for centos6.5. Thanks.

Shares