Passwordless SSH Setup in 5 Minutes

Tired of typing passwords every time you log into a server via SSH? Passwordless SSH authentication using SSH keys is the way to go. It’s secure, efficient, and saves you time. In this guide, I’ll walk you through setting it up in just 5 minutes. Let’s…


This content originally appeared on DEV Community and was authored by kingyou

Tired of typing passwords every time you log into a server via SSH? Passwordless SSH authentication using SSH keys is the way to go. It’s secure, efficient, and saves you time. In this guide, I’ll walk you through setting it up in just 5 minutes. Let’s dive in!

Prerequisites

  • Two machines: One to act as the client (your local machine) and another as the server (remote machine).
  • SSH installed on both devices (most Linux/macOS systems have it pre-installed).
  • Basic Linux/macOS command-line knowledge.

Step 1: Generate an SSH Key Pair on Your Client

Open your terminal and run:

ssh-keygen -t rsa -b 4096
  • Press Enter to accept the default file location (~/.ssh/id_rsa).
  • You can skip setting a passphrase for simplicity, but it’s recommended for added security.

This creates two files:

  • ~/.ssh/id_rsa: Your private key (keep this secret).
  • ~/.ssh/id_rsa.pub: Your public key (this will be placed on the server).

Step 2: Copy the Public Key to the Server

Use the ssh-copy-id command to install your public key on the server:

ssh-copy-id user@server_ip
  • Replace user with your server username (e.g., ubuntu, root).
  • Replace server_ip with the server’s IP address or hostname.

You’ll be prompted to enter your server’s password once, after which your public key is copied to ~/.ssh/authorized_keys on the server.

Step 3: Test Passwordless Login

Try logging in to verify it works:

ssh user@server_ip
  • If successful, you’ll be connected to the server without a password prompt!

Troubleshooting

If you still need a password, check these common issues:

  1. Permissions: Ensure your client’s ~/.ssh folder is 700 and the private key (id_rsa) is 600.
  2. Server-side config: Verify PubkeyAuthentication yes is enabled in ~/.ssh/authorized_keys on the server.
  3. Firewall: Ensure port 22 (default SSH port) is open on the server.

Bonus: Secure Your Private Key

  • Protect the private key (id_rsa) with a passphrase (openssl can help reset one if needed).
  • Store it securely—never share it or commit it to public repositories.

Conclusion

In under 5 minutes, you’ve eliminated passwords from your SSH workflow! This method is widely used in DevOps, cloud servers, and automation pipelines. Just remember to keep your private key safe and rotate it periodically if compromised.

Got questions? Drop them below! Happy hacking! 🚀

Related Tags: SSH, Linux, Security, DevOps, Cloud, Automation

Note: This guide assumes you’re using OpenSSH. For Windows users, use PuTTY or OpenSSH for Windows.


This content originally appeared on DEV Community and was authored by kingyou


Print Share Comment Cite Upload Translate Updates
APA

kingyou | Sciencx (2025-10-22T01:46:11+00:00) Passwordless SSH Setup in 5 Minutes. Retrieved from https://www.scien.cx/2025/10/22/passwordless-ssh-setup-in-5-minutes/

MLA
" » Passwordless SSH Setup in 5 Minutes." kingyou | Sciencx - Wednesday October 22, 2025, https://www.scien.cx/2025/10/22/passwordless-ssh-setup-in-5-minutes/
HARVARD
kingyou | Sciencx Wednesday October 22, 2025 » Passwordless SSH Setup in 5 Minutes., viewed ,<https://www.scien.cx/2025/10/22/passwordless-ssh-setup-in-5-minutes/>
VANCOUVER
kingyou | Sciencx - » Passwordless SSH Setup in 5 Minutes. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/10/22/passwordless-ssh-setup-in-5-minutes/
CHICAGO
" » Passwordless SSH Setup in 5 Minutes." kingyou | Sciencx - Accessed . https://www.scien.cx/2025/10/22/passwordless-ssh-setup-in-5-minutes/
IEEE
" » Passwordless SSH Setup in 5 Minutes." kingyou | Sciencx [Online]. Available: https://www.scien.cx/2025/10/22/passwordless-ssh-setup-in-5-minutes/. [Accessed: ]
rf:citation
» Passwordless SSH Setup in 5 Minutes | kingyou | Sciencx | https://www.scien.cx/2025/10/22/passwordless-ssh-setup-in-5-minutes/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.