I have two machines:
- A server running Lubuntu (ragendbin)
- A PC running Windows 7 (farore)
I have been using SSH to access the Lubuntu server from the Windows PC. However, until now I have been just using Password Authentication, which obviously is not secure. Today is the day I decided to persevere and generate some keys.
Unfortunately, it is not working. When I click on my generated .ppk private key file from my Windows machine (trying to open it with Putty) I just get an error message saying:
PuTTY Error: Unable to open connection to C: Host does not exist.
Below are the steps I went through. Can you tell me what went wrong? Keep in mind that I already had the opensshserver installed on the Lubuntu server, and was using Password Authentication.
I created my keys using
chmod 700 ~/.ssh ssh-keygen -t rsa
I saved them as id_rsa in the .ssh folder, and created a passcode for them.
I turned off password authentication, limited SSH access to just my user and turned off X11 forwarding in
sshd_config:PasswordAuthentication no X11Forwarding no AllowUsers ***I limited SSH in ufw.
I then created a file named
authorized_keysin the.sshfolder, and copied the contents ofid_rsa.pubinto it and saved it.I transferred the privated key (
id_rsa) to my Windows machine, opened it with puttygen.exe, saved it as a.ppkfile.
Now when I try to open that .ppk file with PuTTY itself, I get the error message.
What am I doing wrong? Thank you.
1 Answer
The main thing you're doing wrong is expecting PuTTY to open the .ppk file: as far as I know the key file itself contains no information about the target host (indeed, that wouldn't make sense since the same key pair may be used to access different hosts).
Instead, you should open PuTTY normally, and configure a session to use the key file by selecting Connection --> SSH --> Auth and browsing to the .ppk file under Private key file for authentication:
Alternatively, you can run PuTTY's pagent in your Windows session and add the key to that: PuTTY will then attempt to authenticate via the agent each time instead of requiring explicit specification of the private key file.