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

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

XLibre Xserver: Banned by Red Hat Developer Plans Revival of X11

XLibre Xserver: Banned by Red Hat Developer Plans Revival of X11

VirtualBox 7.1.10 Rolls Out With Windows and Linux Improvements

VirtualBox 7.1.10 Rolls Out With Windows and Linux Improvements

Raspberry Pi Imager 1.9.4 Arrives with UI Polish, Major Fixes

Raspberry Pi Imager 1.9.4 Arrives with UI Polish, Major Fixes

Rocky Linux 9.6 Released with New WSL Support, Updated Packages

Rocky Linux 9.6 Released with New WSL Support, Updated Packages

KDE Encourages Windows 10 Users to Switch to Linux

KDE Encourages Windows 10 Users to Switch to 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

WireGuard Easy v15 Launches with Full Rewrite

WireGuard Easy v15 Launches with Full Rewrite

  • May 31, 2025
ChatGPT's o3 Model Found Remote Zeroday in Linux Kernel Code

ChatGPT’s o3 Model Found Remote Zeroday in Linux Kernel Code

  • May 29, 2025
  • 2 Comments
Tails 6.16 Arrives with Updated Tor Browser

Tails 6.16 Arrives with Updated Tor Browser

  • May 29, 2025
Authelia Authentication Server Achieves OpenID Certified Status

Authelia Authentication Server Achieves OpenID Certified Status

  • May 19, 2025

Copyright © 2025 Linuxiac

  • Privacy
  • About Us
  • Contact Us