Or copy link
Copy link
Passwordless SSH is a way to log in to a remote server without entering the password. It works based on a special algorithm to create secure keys (public and private). These key pairs make the login process more secure and convenient. In short, the Passwordless SSH or SSH without password method is commonly used for securing file transfer to the remote server.
This learning-based guide explains the complete process of setting up and configuring passwordless SSH on a Linux system.
Read also SSH Key vs Password Based Authentication
Here are the essential steps to set up passwordless SSH on Linux-based systems, such as Ubuntu 22.04.
For configuring passwordless SSH, you must have OpenSSH installed on your Linux system.
Step 1: Refresh and Update Package List
To improve your system performance, it is advised to run the update command before installing new packages:
sudo apt update
The command refreshes the list of system packages and notifies you of any outdated packages.
Step 2: Install OpenSSH via APT
If the OpenSSH package is not already installed on your Linux system, you can easily install it from the Ubuntu repository using the apt package manager:
sudo apt install openssh-server -y
After completing the installation, you can initiate the passwordless SSH setup on your Linux system.
Step 3: Check SSH Status
From the Linux terminal, you can verify the status of the OpenSSH service to ensure it is running properly:
sudo systemctl status ssh
Before proceeding to the next step, confirm that your SSH service status is active (running).
Note: You cannot set up passwordless SSH if the SSH is not active.
Explore the capabilities of SSH Hosting
If you seek full control over your server infrastructure, opt for our Self-Managed SSH VPS Hosting. You have a range of performance scaling options at your fingertips, along with absolute root access using SSH keys, providing you with unparalleled control.
Let’s generate the RSA Public key pair for passwordless authentication using the following steps.
Step 1: Generate Public Key Pair
Execute this OpenSSH command to create an SSH key pair:
ssh-keygen
The command will display the necessary details such as the path of the generated key (id_rsa and id_rsa.pub), the algorithm (RSA), and the number of bits (3072).
Step 2: Transfer the Generated Key to Remote Server
The command, such as ssh-copy-id followed by a remote server address, will transfer the generated RSA key to the remote server:
ssh-copy-id [email protected]
During the key transfer process, you will be prompted to enter the password against the particular user ([email protected]) to complete the process.
Step 3: Test SSH
Confirm the SSH configuration by testing the connection to the remote server using the following command:
ssh [email protected]
You will see a welcome note on your terminal screen that shows your SSH has been successfully configured on Linux.
Customize the SSH configuration file to enable passwordless SSH through these steps.
Step 1: Setup Passwordless SSH
To customize the file for passwordless SSH, access the SSH configuration file through the command:
sudo nano /etc/ssh/sshd_config
Locate the line containing the keyword “PasswordAuthentication” and set it to “no”. You can use Ctrl + w from keyboard to find the keyword:
PasswordAuthentication no
Save the changes by pressing Ctrl + S and return to the terminal window by closing the SSH configuration file.
Step 2: Restart SSH Service
After making the required changes in the SSH configuration file, restart the SSH service to ensure the changes take effect:
sudo systemctl restart ssh
The empty output indicates that the command successfully applied the changes made in the configuration file.
Step 3: Close Remote Server
After configuring passwordless SSH, you can exit the remote server with the command:
exit
After following the steps as mentioned above, you have successfully set up passwordless SSH on your Linux-based system.
Passwordless SSH can be configured and set up on Linux using simple steps. First, ensure that OpenSSH is installed on your Linux system. Then, after creating a public key pair, customize the SSH configuration file of the specific remote server to enable passwordless SSH on your system.
This article explained the detailed process of setting up passwordless SSH on Linux-based systems.
Set up passwordless SSH on Linux by creating a key pair and customizing the SSH configuration file to enable passwordless SSH on your Instant VPS system.
Passwordless SSH allows secure and convenient access to remote systems without the need to enter a password each time. It enhances automation, making tasks like scripting and remote management more efficient.
Use the ssh-keygen command. Run ssh-keygen -t rsa to generate a new RSA key pair. Follow the prompts, and you’ll have private and public keys in the ~/.ssh/ directory.
ssh-keygen -t rsa
~/.ssh/
The private key is kept secure on your machine, while the public key is shared with the remote server. The server uses your public key to verify your identity when you try to connect.
Use the ssh-copy-id command. For instance, ssh-copy-id user@hostname will copy your public key to the specified user’s home directory on the remote server.
ssh-copy-id
ssh-copy-id user@hostname
In the evolving field of information technology, remote...
Bash scripts are powerful tools that allow you to autom...
The lock symbol primarily indicates restricted or limit...
Linux operating systems use the "systemctl" command to ...
The man command, short for “manual”, is an essentia...
Displaying the error "ifconfig: command not found" on a...
Save my name, email, and website in this browser for the next time I comment.
Δ