SSH and public key for authentication

(Good coffee made me write about...)

SSH is one of the most attacked services because by breaking in, you can tunnel your connection and attack someone else, and hide your identity under the attacked IP-address(is bad)... or to send spam... or to store illegal material... you name it. So is the first service to protect!

1.Generate your set of key:  private and public


2. Copy the generated key to the server you want to login via ssh


If all went good, you should be able to login passwordless with

$ssh myuser@myserver

If something went bad you need to upload the PUBLIC key to the server using

login to your server your normal ssh with password

then at your home directory create the ~/.ssh directory with

$mkdir ./ssh  (on the server, here the keys are saved)

Now go back to your computer and copy by hand they public key

$cat ~/.ssh/ | ssh youuser@yourserver "cat >> ~/.ssh/authorized.keys"

and try again to login with out the password!

Don upload you private key. 

Now you can disable the password at ssh.conf