Password! Secure Logins with PuTTY and SSH Keys
What are SSH Keys?
SSH keys are a cryptographic duo consisting of a public
key and a private key. The public key resides on the remote server you're
connecting to, while the private key stays securely on your local machine.
During login, PuTTY uses the private key to encrypt a message, and the remote
server's public key verifies the message, granting access.
Benefits of Passwordless Authentication
- Enhanced Security: Eliminates the
risk of password theft or brute-force attacks.
- Convenience: No more
password prompts! Simply connect and you're in.
- Efficiency: Saves time by
skipping the login step.
Be
sure to substitute your custom username in place of “username” as used below.
Setting Up Passwordless Authentication
1. Generate your SSH Key Pair:
- Download PuTTYgen (included in the PuTTY suite).
Download
PuTTY: latest release (0.81) (greenend.org.uk)
https://the.earth.li/~sgtatham/putty/latest/w64/puttygen.exe
- Launch PuTTYgen and choose RSA (recommended) for the
key type.
- Click "Generate" and move your mouse
around to add randomness to the key generation process.
- Save the public key (usually ending in
".pub") and the private key (often ending in ".ppk").
Keep the private key in a secure location!
2. Add the Public Key to the Remote Server:
- Connect to your remote server using traditional
username and password login (assuming you have access).
- Locate the .ssh directory in your home
directory (usually ~/.ssh) and create it if it doesn't exist
(use mkdir ~/.ssh).
- Use a text editor (like vi) to create a file
named authorized_keys within the .ssh directory.
- Paste the contents of your saved public key into
the authorized_keys file.
- Save and close the file.
- Set the permissions on authorized_keys to
ensure only the owner can read and write it (use chmod 600
~/.ssh/authorized_keys).
3. Configure PuTTY for Private Key Use:
- Open PuTTY and create a new session profile or edit
an existing one.
- Navigate to "Connection" ->
"SSH" -> "Auth."
- Click "Browse" and select your saved
private key file (".ppk").
4. Connect Without a Password!
- Save your PuTTY session profile.
- Now, whenever you connect to the server using this
profile, PuTTY will automatically use your private key for authentication,
granting you access without a password prompt.
Add New Comment