User Tools

Site Tools


ssh

Creating an SSH key

Login into an SSH server with a key is preferable to just using a password. The security can be enhanced by assigning a password to the key. Keys without passwords are usefull if you need to run automated jobs like remote backup via ssh.

ssh-keygen -t rsa -b 4096

Copying your public key to a remote server

If you want to install your public key as authorized key on a remote server, the most convenient way is to use the ssh-copy-id tool.

ssh-copy-id <user>@<host>

Troubleshooting

Dealing with "offending key" errors

Under normal circumstances you should take a warning like this seriously:

Warning: the RSA host key for 'ursus-minor.de' differs from the key for the IP address '178.254.25.23'

But if you just reinstalled your server the installation process generates a new host key. Unless you specifically restore the old one (which is a good idea if you other users on your machine whom you don't want to scare) you will end up in such a warning because in your known_hosts file the old key is associated with the hostname and / or the IP address.

Remove the old key:

ssh-keygen -R your_hostname_or_ip

Now connect again and make sure you verify the fingerprint of the host!

ssh.txt · Last modified: 2015/07/12 11:12 by sebastian