Virtual Elementary

Sharing my notes and thoughts about IT Technology

Main Menu

Skip to content
  • Home
  • About
  • About
  • Contact
  • Contact
  • Home

How to Set Up Password-less SSH Login on a Linux Machine

April 24, 2025 · by Sebastian Szumigalski · in Learning Linux, Linux, Linux Comands, linux commands. ·

Do you log in to your Linux server frequently? Tired of entering your password every time? With SSH key-based authentication, you can streamline your workflow by logging in securely without a password.

In this guide, we’ll show you how to set up password-less SSH login in just two steps using ssh-keygen and ssh-copy-id.


What Is Password-less SSH Login?

Password-less SSH login uses public key cryptography to authenticate your access. Instead of typing a password, you use an SSH key pair—one private (stored on your machine) and one public (stored on the server). It’s fast, convenient, and much safer than using passwords alone.


Step 1: Generate an SSH Key Pair

Open a terminal on your local machine and run:

ssh-keygen

You will be prompted:

Generating public/private rsa key pair.
Enter file in which to save the key (/home/yourname/.ssh/id_rsa):

Simply press Enter to accept the default location.

When asked for a passphrase, you can either:

  • Press Enter again for a completely password-less login
  • Or enter a secure passphrase for additional protection

This will generate two files:

  • ~/.ssh/id_rsa (your private key – keep this secret!)
  • ~/.ssh/id_rsa.pub (your public key – safe to share with the server)

Step 2: Copy the Public Key to Your Server

Run the following command to upload your public key to the remote server:

ssh-copy-id username@server_ip

Replace:

  • username with your actual Linux username on the remote server
  • server_ip with your server’s IP address or domain

You’ll be asked to enter your server password one last time. Once complete, the public key will be added to the server’s ~/.ssh/authorized_keys file.


Step 3: Test the Password-less Login

Now try logging in again:

ssh username@server_ip

If everything went well, you’ll log in without needing to enter your password!


🔍 Behind the Scenes: How It Works

Here’s what’s happening:

  1. Your SSH client sends a request to the server.
  2. The server checks for your public key.
  3. If it finds a match, it issues a challenge.
  4. Your private key answers the challenge.
  5. The server validates the answer and grants access—no password required!

Best Practices & Tips

  • Keep your private key secure. Do not share it.
  • Set correct file permissions:
  chmod 700 ~/.ssh
  chmod 600 ~/.ssh/authorized_keys
  • Use a passphrase on your key for additional security.
  • Consider backing up your keys in a secure, encrypted location.

Extra tip:

Create alias which contain the command to ssh to you remote server:

alias pi = “ssh username@ipaddress”

Now you will be able to connect to your remote server just by typing pi.

To keep this alias permanently on your system add it to your bash settings file.


Conclusion

That’s it! In just a few minutes, you’ve set up a secure, password-less SSH login. This small tweak can save you time and improve your server’s security. Whether you’re managing personal servers or enterprise systems, SSH keys are the way to go.

Happy logging in—no password required! 🧑‍�

Share this:

  • Tweet
  • Click to email a link to a friend (Opens in new window) Email
Like Loading...
Tags: linux commands, Passwordless SSH, secure Linux login, SSH key login

Post navigation

← LFCS Admin Exam preparation guide – Change kernel runtime parameters, persistent and non-persistent

vExpert 2017-2019

vExpert-2017-Badge
vExpert2018

Badges

vmware-certified-advanced-professional-6-desktop-and-mobility-deployment
vmware-certified-professional-6-data-center-virtualization
vmware-certified-professional-6-desktop-and-mobility

Archives

  • April 2025 (1)
  • June 2020 (6)
  • May 2020 (11)
  • February 2019 (1)
  • November 2018 (1)
  • August 2018 (1)
  • March 2018 (1)
  • February 2018 (1)
  • October 2017 (1)
  • September 2017 (2)
  • May 2017 (2)
  • April 2017 (1)
  • March 2017 (3)
  • February 2017 (5)
  • January 2017 (1)
  • December 2016 (3)
  • November 2016 (6)
  • October 2016 (9)
  • September 2016 (3)
  • August 2016 (12)
  • July 2016 (1)
  • June 2016 (1)
  • May 2016 (1)

Blogs I Follow

  • Raymond Onggara – Ed | Tech
  • My Blog
  • blog.nigelpoulton.com
  • Tao Yang's System Management Blog
  • Mandie's Memos
  • Jason Yoder, MCT
  • Pascal's Wereld
  • Cloud Essentials
  • Blog
  • vPentathlon
  • Let's Virtualize
  • RY Nami Test
  • Power in the shell
  • dexterposh
  • PwrShell.net
  • TEK RōNIN
  • Hitchcode
  • Jaap Brasser's Blog
  • Ravikanth Chaganti
  • d.evops.co

Social

  • View SzumigalskiS’s profile on Twitter
  • View sebastian-szumigalski’s profile on LinkedIn

Cloud

https://www.cloudcredibility.com/profile/widget/15633

Follow me on Twitter

My Tweets
Blog at WordPress.com.
Raymond Onggara – Ed | Tech

Sharing my notes and thoughts about IT Technology

My Blog

blog.nigelpoulton.com

Tao Yang's System Management Blog

Mandie's Memos

Learning about Docker, Kubernetes and other technologies the hard way... so you don't have to.

Jason Yoder, MCT

Sharing my notes and thoughts about IT Technology

Pascal's Wereld

Cloud Essentials

Cloud Operations

Blog

vPentathlon

Let's Virtualize

Sharing my notes and thoughts about IT Technology

RY Nami Test

Power in the shell

Davids Blog

dexterposh

Sharing my notes and thoughts about IT Technology

PwrShell.net

Sharing my notes and thoughts about IT Technology

TEK RōNIN

Hitchcode

Technology and life ...

Jaap Brasser's Blog

Ravikanth Chaganti

d.evops.co

Sharing my notes and thoughts about IT Technology

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy
  • Subscribe Subscribed
    • Virtual Elementary
    • Already have a WordPress.com account? Log in now.
    • Virtual Elementary
    • Subscribe Subscribed
    • Sign up
    • Log in
    • Copy shortlink
    • Report this content
    • View post in Reader
    • Manage subscriptions
    • Collapse this bar
 

Loading Comments...
 

    %d