Category Archives: SSH
All about SSH
How to use an SSH connection as a SOCKS proxy
In this article I will describe how to use an SSH connection as a SOCKS proxy. This basically means that you can route the network traffic of any application or even your entire systems traffic through an SSH connection.
Read the rest of this entry
How to login to ssh using public key authentication
First you have to create a public, private key pair. For this you can use the command-line tool sshkey-gen.
Change the directory to “~/.ssh” (create it, if it does not exist).
cd ~/.ssh
Create key pair
Now let’s create the key pair. In this example I will use RSA with 4096 Bit
ssh-keygen -t rsa -b 4096
Enter a passphrase if you want but you don’t have to. I recommend to enter a passphrase.
Transfer public key to ssh server
To transfer the public key to the ssh server you can use ssh-copy-id.
ssh-copy-id -i ~/.ssh/id_rsa.pub HOST
Login with key
Now you should be able to login with the created key.
ssh USERNAME@HOST
How to manage ssh host keys
Linux saves the ssh host keys in ~/.ssh/known_hosts. You can manage these ssh host keys with the command ssh-keygen.
Examples:
Search for a specific host (in known_hosts):
ssh-keygen -F HOSTNAME
Remove a specific host:
ssh-keygen -R HOSTNAME
To add a new ssh host key you can use ssh-keyscan. This command print the ssh host key on the stdout. So we have to append this key to the known_hosts file.
Example:
ssh-keyscan -H HOSTNAME >> ~/.ssh/known_hosts