Setting up SSH Passwordless Login in Linux [3 Easy Steps]

Posted by

SSH (Secure SHELL) is an open-source and most trusted network protocol that is used to log in to remote servers for the execution of commands and programs. It is also used to transfer files from one computer to another computer over the network using a secure copy (SCP) command and Rsync command.

[ You might also like: How to Secure and Harden OpenSSH Server ]

In this article, we will show you how to set up password-less login on RHEL-based Linux distributions such as CentOSFedoraRocky Linux & AlmaLinux, and Debian-based distributions such as Ubuntu & Mint using ssh keys to connect to remote Linux servers without entering a password.

Using Password-less login with SSH keys will increase the trust between two Linux servers for easy file synchronization or transfer.

My Setup Environment
SSH Client : ( Fedora 34 )
SSH Remote Host : ( CentOS 8 )

If you are dealing with a number of Linux remote servers, then SSH Password-less login is one of the best ways to automate tasks such as automatic backups with scripts, synchronization files using SCP command, and remote command execution.

[ You might also like: 25 Outstanding Backup Utilities for Linux Systems ]

In this example, we will set up SSH password-less automatic login from server as user linuxtechexpert to with user sheena.

Step 1: Create Authentication SSH-Keygen Keys on – (

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

$ ssh-keygen -t rsa

Generating public/private rsa key pair.
Enter file in which to save the key (/home/linuxtechexpert/.ssh/id_rsa): [Press enter key]
Created directory '/home/linuxtechexpert/.ssh'.
Enter passphrase (empty for no passphrase): [Press enter key]
Enter same passphrase again: [Press enter key]
Your identification has been saved in /home/linuxtechexpert/.ssh/id_rsa.
Your public key has been saved in /home/linuxtechexpert/.ssh/
The key fingerprint is:
The key's randomart image is:
+--[ RSA 2048]----+
|        ..oooE.++|
|         o. o.o  |
|          ..   . |
|         o  . . o|
|        S .  . + |
|       . .    . o|
|      . o o    ..|
|       + +       |
|        +.       |

Step 2: Upload SSH Key to –

Use SSH from server and upload a new generated public key ( on server under sheena‘s .ssh directory as a file name authorized_keys.

$ ssh-copy-id sheena@

Step 3: Test SSH Passwordless Login from

From now onwards you can log into as sheena user from server as a tecmint user without a password.

$ ssh sheena@

In this article, you’ve learned how to set up an SSH Passwordless login using an ssh key. I expect that the process was straightforward. If you have any questions, please post them in the comment section below.


  1. I was extremely pleased to discover this page. I want to to thank you for ones time due to this wonderful read!! I definitely appreciated every part of it and I have you bookmarked to look at new information on your web site.

Leave a Reply

Your email address will not be published. Required fields are marked *