Secure Shell
A key is a secret code that proves who you are. A key pair is two matching keys, one private and one public.
Make a key pair
The pair has two files, one private and one public. The -t option picks the key kind, and -f picks the file name.
$ ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -N '' -C 'alex@example.com'The two files
The pair lives in the .ssh folder.
$ ls ~/.sshThe fingerprint and the public key
The fingerprint names the key. The public key is the part you share.
$ ssh-keygen -l -f ~/.ssh/id_ed25519.pub
$ cat ~/.ssh/id_ed25519.pubCheck the ssh version
The version line proves ssh is ready.
$ ssh -VExample
$ ls ~/.ssh
$ ssh-keygen -l -f ~/.ssh/id_ed25519.pub
$ ssh -VKey points
- A fingerprint is a short code that names one key.
- A remote machine is a machine somewhere else.
- Use ssh-keygen to make a key pair.
- Keep the private key secret.
- Share the public key freely.
- The -N option sets the key password, and two quotes mean no password.
- The -C comment names the owner of the key.
- Your fingerprint will differ from the one shown here.
In this example, ls shows the two key files. The fingerprint names the key. The version line shows the ssh program is ready.
Note
The private key never leaves this machine.
Try it Yourself
Edit the code, then press Run.
Running is simulated
Exercise
What does ssh-keygen make?