How to Connect to Remote Servers Without Typing a Password
Learn how to set up SSH key authentication in under 5 minutes to eliminate password fatigue and secure your remote server access.

Stock photo for illustration only, not from the actual event
- Set up in under 5 minutes using the command line
- Use Ed25519 keys for superior speed and security
- Manage multiple servers effortlessly with SSH config
As an operations engineer, SSHing into remote servers is a daily routine. The frustration of typing passwords on cold terminals at 3 AM is all too familiar until discovering SSH key authentication, which completely transforms the workflow.
This guide demonstrates how to set it up in less than 5 minutes without GUI tools or expensive software, relying purely on the command line. While password authentication still serves a purpose for temporary access or shared machines, keys are the ultimate choice for regular tasks.

Stock photo for illustration only, not from the actual event
The first step is generating a key pair on your machine using ssh-keygen -t ed25519 -C "your_email@example.com". Ed25519 is recommended due to its speed and security advantages over the older RSA standard, falling back to ssh-keygen -t rsa -b 4096 only when working with legacy systems.
SSH key authentication leverages asymmetric cryptography using a public and private key pair, offering significantly higher security than traditional passwords vulnerable to brute-force attacks. It also removes the operational risk of mistyping credentials on production environments.
Once keys are generated, copy the public key to the remote server using ssh-copy-id username@server_ip. You will be prompted for the server password one last time, after which the public key gets appended to ~/.ssh/authorized_keys on the remote machine.
Test the connection with ssh username@server_ip. If it logs you in without a password prompt, the configuration is complete. If issues arise, inspect sudo nano /etc/ssh/sshd_config to ensure PasswordAuthentication no and PubkeyAuthentication yes are set, then restart via sudo systemctl restart sshd.
A crucial warning: keep your current session open while testing! If anything goes wrong, you can fix it immediately before accidentally locking yourself out of the system.
As your infrastructure scales and keys accumulate, managing them via a config file keeps things organized. You can map host aliases, IP addresses, usernames, and identity files for production or staging environments, allowing you to connect simply by typing ssh production or ssh staging.
Additionally, rotate your keys every 90 days by generating new ones and moving old credentials into a revoked_keys file on the server. SSH key authentication takes minimal effort to configure and pays dividends for years to come, eliminating password fatigue and brute-force worries.
Source: Dev.to
Found something wrong in this article? Report an issue with this article
Comments
Leave a Comment