Secure Remote Access on Servers
Securely accessing servers is a fundamental task in system administration, whether you’re managing a single server or an extensive infrastructure. Traditional password-based logins, while straightforward, can introduce several challenges and security risks, such as password fatigue, brute-force attacks, and vulnerability to interception during transmission.
Passwordless SSH login provides a modern and more secure alternative by using SSH key-based authentication. This approach not only eliminates the need to remember or repeatedly enter passwords but also significantly enhances security. SSH keys are much harder to compromise compared to traditional passwords, and they enable encrypted, automated, and seamless connections.
Introduction

Set up passwordless SSH login on Ubuntu with key-based authentication. By configuring SSH key-based authentication, you can replace traditional passwords with a public-private key system. This guide walks you through generating SSH keys, transferring the public key to your server, and testing the connection to ensure passwordless access.
More information about OpenSSH authentication key utility you can finde at the link.
In this article, we’ll walk through how to set up passwordless SSH login on Ubuntu. From generating SSH keys to configuring the server to only allow key-based authentication, this guide will equip you to establish efficient and secure server access tailored to your needs.
Prerequisites for Setting Up Passwordless SSH Login
- Ubuntu System (Client and Server):
- You must have an Ubuntu server or remote system where you wish to log into without using a password, as well as a local machine (client) from which you will be initiating the connection.
- SSH Installed on Both Machines
Steps to be Done to Configure Passwordless SSH Login on Ubuntu
- Step 1: Generate SSH keys on your Local PC/Local Server
- To connect to an Ubuntu server via SSH without typing a password, you can use SSH key-based authentication. Here’s a step-by-step guide to setting it up:
# Generate the SSH key pair using the following command:
ssh-keygen -t rsa
- Step 2: Save generated keys on default location
- When prompted, save the key in the default location (
~/.ssh/id_rsa
) and optionally set a passphrase (to be able to connect without password do not type password)
- When prompted, save the key in the default location (
- Step 3: Copy the key to the target machine, where you plan to have Passwordless Connection
# Navigate to the folder with key -> Replace user with your user
cd /home/user/.ssh/
# Copy the key to the target machine
ssh-copy-id -i id_rsa.pub user@IP_ADRESS_OF_TARGET_SERVER
- Step 4: Test SSH Key-Based Authentication from Local PC/Local Server
ssh user@IP_ADRESS_OF_TARGET_SERVER
Conclusion
Setting up passwordless SSH login on Ubuntu is a straightforward process that significantly improves both security and convenience for server access. By generating an SSH key pair, saving the keys securely, copying the public key to the target server, and testing the connection, you eliminate the need for repetitive password entry. This setup is especially beneficial for tasks like server administration, automation, and secure remote connections.
By replacing password-based logins with SSH key-based authentication, you not only enhance security against unauthorized access but also streamline your workflow for both individual and automated connections. Take the final step of disabling password-based authentication on your server to ensure maximum security and enjoy a seamless login experience across your systems.