Puddinq.com sharing knowledge

Generating ssh key

Generating ssh key

An ssh key holds information that once combined with a login action lets you login without using a password*. This is very useful if you login regularly. 

* You have to leave the keyphrase empty while generating the key file in order to login without anything more than a username.

Basically you log in to the account you want the key file for, run a command and view the contents of the result:

$ ssh username@localmachine
username@localmachine's password:
username@localmachine:~$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/var/services/homes/username/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /var/services/homes/username/.ssh/id_rsa.
Your public key has been saved in /var/services/homes/username/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:JvAD3zkQWHN/oqgqJyoK+XvvscuSAeA/voQECg1VcIM username@localmachine
The key's randomart image is:
+---[RSA 2048]----+
|..o++o+ .        |
|.oE... + .       |
|+.. o .   o .    |
|+..  = + o o     |
|....  * S        |
|...o.. + .       |
|o...oo.          |
|=.oo+. o         |
|*+++.+*.         |
+----[SHA256]-----+
username@localmachine:~$ cat ~/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2E00000000000000000000nHNTHwm7rK4sZbqDZOEbQ8fw0GgQzBGQj6e
9IvHWAV4F1GZ5WZvZSojZcrV/wH1pKU60qa3D9wZRETMBJHee6ou/WxNzjjcZbwkmkNRzmIzBfyfFF
tXjGo9u0ZRtW/H2NQTRKXTcgT7Blsd1eq7eokasJ2lIUa8mKTqfQm1oV0mHsn1FPxBUSugWn8JlHes
9AcZrYco2EhU5XUVJSDCEpN8tcfZqmWj/ZLKufgzUkBHxFIwru6fBX1NZYev1yzAtlvh5uCxljt9y1
a1SQYnA6ICRgf4yQdr8caESDqiI3Z8zJHBM2lm4xu2RJaTJTiAv2OfHALcAo0/if3NMrp username@localmachine
username@localmachine:~$

With the cat command the keyfile is displayed, and you can use it for other things.

  • Post on how to do this on an external server: link
  • Post on how to generate a key file for use on FileZilla: link