How to set up keys from Windows with PuTTY
- Generate key pair in PuTTYgen (on client) – the passphrase you use here will replace password at login
- Save both keys to a secure location (on the client)
Setup authroized keys on the server
mkdir ~/.ssh chmod 700 ~/.ssh touch ~/.ssh/authorized_keys chmod 600 ~/.ssh/authorized_keys vi ~/.ssh/authorized_keys
open the PUBLIC key on the client and copy it to the server (authorized_keys file) – The file should be formatted (exactly, with no CR or LF chars)
ssh-rsa the_key_string the_key_comment
add the private key to PuTTY (in PuTTY config)
Connection > SSH > Auth > Private key file for...
- Verify the server is accepting the key by logging in with PuTTY
disable password authentication (on ssh server)
sudo vi /etc/ssh/sshd_config # locate the line PasswordAuthentication yes # and replace it with PasswordAuthentication no # remember to restart sshd sudo service ssh restart
Verify that you CAN’T log in WITHOUT the key.
Certain things may not work well with PuTTY by default (vi arrow keys, crtl-left/right between words, color output). Ensure the following options are set:
Terminal > Features > [ ] Disable application cursor keys mode [x] Disable application keypad mode Connection > Data > Terminal details Terminal-type string = putty-256color