Configure SSH on server

dawks

Diamond Member
Oct 9, 1999
5,071
2
81
I just got a a Ubuntu 10.04 LTS VPS server and I am trying to secure it some what. I am trying to get SSH setup to NOT use a password and instead use Public and Private keys using putty on Windows.

I've followed this guide (https://help.ubuntu.com/community/SSH/OpenSSH/Keys), but I dont see how to get the key files to my desktop. I see the command ssh-copy-id <username>@<host> but how will that get the file to my Windows Host?

Where would puttygen.exe fit into this? I've generated a strong key with it, but I can't see how to get the key to the server. Also where would I want to store the keyfile on the server? The guide isnt clear.

Linux newb here obviously, but trying to learn!

Is there a better, clearer guide? or can someone break down the steps so I can have a better understanding of the process?

Thanks.
 

MrColin

Platinum Member
May 21, 2003
2,403
3
81
The keys you generated are for the client actually. copy id_rsa and id_rsa.pub to your local computer someplace safe. Delete the private key from the server afterwards. Better yet, just delete them both and use puttygen to generate a key on your local machine. Like this:
PuTTYgen-5.png


Log in using a password, create the ~/.ssh directory on the host. Use nano or vi to write the string from your public (see picture where it says "Public key for pasting...") key to .ssh/authorized_keys (all on one line) set the permissions per the guide you cited above for your ~/.ssh directory, and attempt logging in with the key. Once it works you can disable password auth.

Important to note, your private key has no business existing on your server, it is the file specified by the putty client under Connection > SSH > Auth and it will have a *.ppk file extension if you make it with puttygen.

Alternatively, keep the keys you generated on the server, in you .ssh directory enter the command
Code:
 cat id_rsa.pub >> authorized_keys
and bring the id_rsa (private key) to your local machine and import it with puttygen
 
Last edited:

Using OpenBSD

Junior Member
Mar 16, 2013
7
0
0
Also, hopefully it is a regular install. I performed the exact advice recommended on another project last year and it would not work because the home directory was encrypted. No /home encryption, and you are good to go.