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

Red Hat Offers Free RHEL Access for Business Developers

Red Hat Offers Free RHEL Access for Business Developers

CachyOS July 2025 Update Brings Shell Choice, Wayland Defaults

CachyOS July 2025 Update Brings Shell Choice, Wayland Defaults

KDE ISO Image Writer Gets a Makeover

KDE ISO Image Writer Gets a Makeover

Wayback Becomes Part of the FreeDesktop.org Ecosystem

Wayback Becomes Part of the FreeDesktop.org Ecosystem

How to Install Docker on Rocky Linux 10: A Step-by-Step Guide

How to Install Docker on Rocky Linux 10: A Step-by-Step Guide

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

Multiple CVEs Patched in Latest Git Update

Multiple CVEs Patched in Latest Git Update

  • July 9, 2025
Parrot OS 6.4 Lands with New Tools and Linux Kernel 6.12

Parrot OS 6.4 Lands with New Tools and Linux Kernel 6.12

  • July 7, 2025
Let’s Encrypt Begins Supporting IP Address Certificates

Let’s Encrypt Begins Supporting IP Address Certificates

  • July 6, 2025
Ubuntu 24.10 Nears Its End of Life

Ubuntu 24.10 Nears Its End of Life

  • June 30, 2025

Copyright © 2025 Linuxiac

  • Privacy
  • About Us
  • Contact Us