Skip to content
No results
  • Home
  • News
    • OS
    • Software
    • Hardware
    • Weekly Wrap-Up
  • Linux Knowledge
    • General
    • Tutorials
    • Tips & Tricks
  • Linux Distributions
Linuxiac
  • Home
  • News
    • OS
    • Software
    • Hardware
    • Weekly Wrap-Up
  • Linux Knowledge
    • General
    • Tutorials
    • Tips & Tricks
  • Linux Distributions
Linuxiac
Home Linux Knowledge Tutorials How to Setup SSH Login Without Password

How to Setup SSH Login Without Password

This article will show you how to set up an SSH login without passwords in a Linux operating system by using key-based authentication

  • ByBobby Borisov
  • OnNovember 29, 2021
  • UpdatedOctober 7, 2022
SSH Without Password

SSH is used for logging into servers to run the commands and programs remotely. However, sometimes you might want or even need to automatically log in to an SSH server without entering your username and password.

The two most popular mechanisms to log into remote systems via SSH are password-based authentication and key-based authentication.

Username and password combination is the most common authentication method for SSH and is suitable for most people. Unfortunately, there are certain security risks associated with using this method.

On the other hand, if you regularly use SSH to connect to remote servers, the key-based authentication method is best for you.

So, can you SSH without a password? In short, yes! Here’s how to do it.

Step 1: Generate SSH Key Pair

You first need to generate an SSH key pair on the machine you are currently working on.

If you are unsure how to do it I recommend following our short and easy to follow guide: Generate an SSH Key Pair [with Examples].

Step 2: Copy the Public Key to Remote Server

To enable SSH login without a password, you need to transfer a copy of your SSH public key to the remote server. Therefore, you need to know your remote server’s credentials and several other details, such as hostname/IP, username, password, and port number.

To transfer the public key to the remote server, we will use the ssh-copy-id command that is available in most Linux distros. The command will copy the content of public key .ssh/id_rsa.pub to the .ssh/authorized_keys file in the remote system. 

ssh-copy-id user@remote-hostCode language: CSS (css)
SSH Without Password - Copy Public Key to Remote Server

You will be prompted to enter the remote username password. Once the user is authenticated, the public key will automatically be copied into the .ssh/authorized_keys file on the remote server.

On the remote server, you can verify the transfer of the public key by viewing the content of the .ssh/authorized_keys file.

Remote Server authorized_keys File

For more about the ssh-copy-id command in Linux, consult its manual page.

Step 3: SSH Login Without Password

Now you should be able to login into the remote server without being prompted for a password. Just try to login into your server via SSH:

ssh username@remote_serverCode language: CSS (css)

The system should log you directly to the remote server; no password is required.

SSH Login Without Password - Successfully Logged In

Conclusion

That is all you need to set up an SSH login without passwords. Then, of course, you can add the same public key to multiple remote serves.

Finally, it’s important to note that you can share the public key (id_rsa.pub) with anyone but never share your private key (id_rsa). Only the public key is copied to the server.

The private key should never be copied to another machine because anyone with the private key will be able to log into any system having the matching public key.

If you have any questions or feedback, feel free to leave a comment.

Tell others:

Share on X (Twitter) Share on Reddit Share on Facebook Share on Threads Share on Bluesky Share on Telegram Share on LinkedIn Share on Hacker News

Bobby Borisov

Bobby Borisov

Bobby, an editor-in-chief at Linuxiac, is a Linux professional with over 20 years of experience. With a strong focus on Linux and open-source software, he has worked as a Senior Linux System Administrator, Software Developer, and DevOps Engineer for small and large multinational companies.

Leave a ReplyCancel Reply

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

Trending

openSUSE Leap 16.0 Released, This Is What's New

openSUSE Leap 16.0 Released, This Is What’s New

Raspberry Pi OS Based on Debian 13 Now Available for Download

Raspberry Pi OS Based on Debian 13 Now Available for Download

Linux Mint Showcases a Redesigned Menu

Linux Mint Showcases a Redesigned Menu

KDE Plasma 6.5 Beta Released, This Is What's New

KDE Plasma 6.5 Beta Released, This Is What’s New

How to Get Notified on SSH Logins on Linux

How to Get Notified on SSH Logins on Linux

SUPPORT ME

Enjoy the article?
Just $2 and a moment of your time keep my Linux writing going 24/7. Please be kind and contribute a cup
.

Support me on Ko-Fi

Related Posts

How to Get Notified on SSH Logins on Linux

How to Get Notified on SSH Logins on Linux

  • October 5, 2025
  • 2 Comments
OpenSSL 3.6 Released with New FIPS, LMS Signatures

OpenSSL 3.6 Released with New FIPS, LMS Signatures

  • October 1, 2025
Kali Linux 2025.3 Brings Nexmon Wi-Fi Support for Raspberry Pi

Kali Linux 2025.3 Brings Nexmon Wi-Fi Support for Raspberry Pi

  • September 23, 2025
IPFire 2.29 Core Update 197 Firewall Adds OpenVPN 2.6

IPFire 2.29 Core Update 197 Firewall Adds OpenVPN 2.6

  • September 19, 2025

Copyright © 2025 Linuxiac

  • Privacy
  • About Us
  • Contact Us