This guide shows how to enable Passwordless SSH login in Linux.
Passwordless SSH enables you to connect to a remote Linux server without entering a password each time, using SSH key pairs to enhance security and simplify tasks such as automation and remote management.
Follow the steps to enable Passwordless SSH Login:
- Create an SSH key pair on the local machine by opening your terminal and running:
ssh-keygen -t rsa -b 4096
- To accept ~/.ssh/id_rsa as the default file location, click Enter.
- You can optionally set a passphrase for added security or leave it blank.
- Copy the Public key to the remote server
The ssh-copy-id command can be used to duplicate your public key:ssh-copy-id username@remote_server_ip
- Replace username with your remote account name.
- Replace remote_server_ip with your server’s IP or hostname.
- Enter your password one last time to authenticate.
Alternative method: If ssh-copy-id is not available, manually append the public key to the remote server’s ~/.ssh/authorized_keys file:cat ~/.ssh/id_rsa.pub | ssh username@remote_server_ip "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
- Set correct permissions on the remote server to ensure security:
chmod 700 ~/.ssh chmod 600 ~/.ssh/authorized_keys
- Test passwordless SSH login by connecting to the server:
ssh username@remote_server_ip
You should now log in without entering a password.
Tips & Best Practices
- Use strong passphrases if you store keys without a password.
- Store your keys securely and never share the private key (id_rsa).
- Use ssh-agent to manage multiple SSH keys.
- Regularly rotate keys for enhanced security.
Passwordless SSH login is widely used for automation, backups, and secure remote management, making Linux administration faster and safer. Hope you liked our article.
Want to simplify SSH key management? Learn How to manage SSH keys in cPanel