Let us discuss a small topic about the ssh password-less login setup. I have received many requests from Linux beginners for creating this article.
SSH (Secure SHELL) is an open source and most trusted network protocol that is used to login into remote servers for execution of commands and programs. It is also used to transfer files from one computer to another computer over the network using secure copy (SCP) Protocol.
Let me show you how to create a password-less authentication between servers .
In this example I am going to setup SSH password-less automatic login from server 192.168.1.57 as user vinil to 192.168.1.59 with user admin.
First login to 192.168.1.57 as user vinil and create a public keys using ssh-keygen command.
Here is the key pairs, which was created with the ssh-keygen command.
Now let us copy the public key to the 192.168.1.59 for admin user. Run the following command to copy the public key to the destination server.
First create .ssh directory on 192.168.1.59 server or if you run ssh-keygen command as admin user it will create the directory and authorized_keys file. Here i am going to create the directory.
$ ssh admin@192.168.1.59 mkdir -p .ssh
Now copy the public key using the following command.
$cat id_rsa.pub |ssh 192.168.1.59 'cat >> ~admin/.ssh/authorized_keys && echo "copied"'
Now set the correct permission for .ssh directory and .ssh/authorized_keys using the following command.
$ ssh admin@192.168.1.59 "chmod 700 .ssh; chmod 640 .ssh/authorized_keys"
Now test the login, You would be able to login from 192.168.1.57 as vinil to 192.168.1.59 as admin with out any password.
That's all about it !! Hope you like it.
SSH (Secure SHELL) is an open source and most trusted network protocol that is used to login into remote servers for execution of commands and programs. It is also used to transfer files from one computer to another computer over the network using secure copy (SCP) Protocol.
Let me show you how to create a password-less authentication between servers .
In this example I am going to setup SSH password-less automatic login from server 192.168.1.57 as user vinil to 192.168.1.59 with user admin.
First login to 192.168.1.57 as user vinil and create a public keys using ssh-keygen command.
Here is the key pairs, which was created with the ssh-keygen command.
Now let us copy the public key to the 192.168.1.59 for admin user. Run the following command to copy the public key to the destination server.
First create .ssh directory on 192.168.1.59 server or if you run ssh-keygen command as admin user it will create the directory and authorized_keys file. Here i am going to create the directory.
$ ssh admin@192.168.1.59 mkdir -p .ssh
Now copy the public key using the following command.
$cat id_rsa.pub |ssh 192.168.1.59 'cat >> ~admin/.ssh/authorized_keys && echo "copied"'
Now set the correct permission for .ssh directory and .ssh/authorized_keys using the following command.
$ ssh admin@192.168.1.59 "chmod 700 .ssh; chmod 640 .ssh/authorized_keys"
Now test the login, You would be able to login from 192.168.1.57 as vinil to 192.168.1.59 as admin with out any password.
That's all about it !! Hope you like it.
No comments:
Post a Comment