How to connect in SSH without password

by Ismail.EL
0 comment

How to connect in SSH without password

The SSH protocol allows you to connect to a remote machine securely using asymmetric cryptography. SSH is widely used by system administrators because it is simple to set up and very powerful.
However, by default, you must use a password to authenticate on a remote computer with SSH. It is not very restrictive if you have a single server, but if you have several machines with the need to script to automate certain tasks, it becomes complicated for 2 reasons. The first is that it is not easy to “script” an SSH connection with a password. The second is that it is not at all secure since the password is hard coded.
In this tutorial, we will see how to set up a public key / private key system to connect without password securely.

In this article, we will show you How to connect in SSH without password

My Setup Environment

In this example, we will set up SSH password-less automatic login from server 192.168.1.10 as user devopsclient to 192.168.1.11 with user devopsserver.

Step 1: Create Authentication SSH-Keygen Keys on

First login into server 192.168.1.10 with user devopsclient and generate a pair of public keys using the following command.

Step 2: Create .ssh Directory on (server) – 192.168.1.11

Use SSH from server 192.168.1.10 to connect server 192.168.1.11 using devopsserver as a user and create .ssh directory under it, using the following command.

Step 3: Upload Generated Public Keys to (server) – 192.168.1.11

Use SSH from server 192.168.1.10 and upload a new generated public key (id_rsa.pub) on server 192.168.1.11 under devopsserver‘s .ssh directory as a file name authorized_keys.

Step 4: Set Permissions on – 192.168.1.11

Due to different SSH versions on servers, we need to set permissions on .ssh directory and authorized_keys file.

Step 5: Login from 192.168.1.10 to 192.168.1.11 Server without Password

From now onwards you can log into 192.168.1.11 as devopsserveruser from server 192.168.1.10 as devopsclient user without a password.

Conclusion

In this post, i have explained How to connect in SSH without password.
If you have any questions or feedback, feel free to leave a comment.
As always, if you found this post useful, then click like and share it 🙂

20480cookie-checkHow to connect in SSH without password

Related Posts

Leave a Comment