You can configure or setup Passwordless SSH login by following 3 simple steps. Here’s how.
SSH is an acronym used for Secure Shell. The SSH is an open-source network protocol that allows users, system administrators, a highly secure remote connection to access a computer over an unprotected network. SSH makes it easy to manage servers, copy, or transfer files on a remote server through encrypted channels.
There are two modes to login onto a remote system over SSH
Method 1 – Password Authentication
Method 2 – Public Key Authentication (Passwordless SSH Login)
Do you know?
Implementing passwordless SSH login ensures a resilient trust between two Linux servers for streamline file transfer or synchronization.
Therefore, here, you will know how to setup passwordless login. It includes RedHat Enterprise Linux-based distributions Rocky Linux, AlmaLinux, CentOS, Fedora, Oracle Linux, Clear OS, and Debian-based Linux Mint & Ubuntu. Using the below-discussed method helps you to connect Linux servers without typing a password.
Let’s begin!
Prerequisites to Configure Passwordless SSH Login
- You must have Command line / Terminal window.
- User should have sudo or root privileges.
- Local Server & Remote Server. Here we take two servers – 192.xx8.0.x5 (Local Server with user netforchoice) & 192.xx8.0.x4 (Remote Host with user zoopdesk).
- SSH access to a remote server through a command line or terminal window
Before Jump Into Steps – Check For Existing Keys
It might be possible that your machine already has SSH key pair. First, run the command to see whether you have SSH keys on the system or not.
ls -al ~/.ssh/id_*.pub
In case the result shows no files, jump to the passwordless ssh login configuration steps. Although if the results show you have the keys, save a copy of it and create a new pair or overwrite it.
How to Setup SSH Passwordless Login in RedHat Enterprise Linux – 3 Simple Steps
The configuration of passwordless SSH in linux broadly requires three steps. Thus, understand each step in detail
Step 1 – Key Generation on 192.xx8.0.x5
Run command – ssh-keygen to create a key pair. Opt the defaults at all prompts.
$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/netforchoice/.ssh/id_rsa):
Created directory '/home/netforchoice/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/netforchoice/.ssh/id_rsa.
Your public key has been saved in /home/netforchoice/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:qOoqJFfbfnBFMZ6JEdZQZfy6WXTfcknQEd0B+quTwJh netforchoice@netforchoice.com
The key's randomart image is:
+---[RSA xxxx]----+
| .+*+o.o+*|
| oo*o. .o|
| .*. .. |
| . . o. . o..|
| . o. S. +..+|
|... ..o . . +.+|
|o. .. o. o .= o |
|. . . .o E+ |
|ooo . ... |
+----[xxAxx6]-----+
The default key location is ~/.ssh directory. It will create automatically if it doesn’t exist.
Step 2 – Upload SSH Key to – 192.xx8.0.x4
Time to utilize the SSH from server 192.xx8.0.x5 and upload a new resultant public key on server 192.xx8.0.x4 under zoopdesk .ssh directory under the file name authorized_keys.
$ssh-copy-id zoopdesk@192.xx8.0.x4
Step 3: Test SSH Passwordless Login from 192.xx8.0.x5
Now, you can log into 192.xx8.0.x4 as a zoopdesk user from the server 192.xx8.0.x5 as a netforchoice user without a password.
$ ssh zoopdesk@192.xx8.0.x4
Final Say On Setup Passwordless SSH Login!!
The SSH plays a key role while accessing the computers over the unsecured network. Therefore, in this write-up, we have discussed the best way to set up SSH password login in Linux using ssh key command.
Moreover, if you face problems in managing your Linux server, you can connect with NetForChoice engineers. They are the best consultant who can give you the proper guidance on managing your server by outsourcing the IT department while keeping your cost budget intact. To know more click the link below.