Create a Public SSH Key
Before you can use key-based authentication, you will need to have a key on your own system.
UNIX
From your local machine's terminal, use the following command to create a private (id_rsa
) and public (id_rsa.pub
) key pair:
Where -t rsa
enforces the RSA encryption algorithm and -b 4096
sets the key's length in bits.
You will be prompted to choose where to save the files and if you would like to protect the key with a passphrase. Press enter to skip these steps.
Once the command has finished, navigate to .ssh/id_rsa.pub
and open the file in your text editor of choice.
Windows
You can generate an SSH key on Windows 10 or later using the ssh-keygen command.
- Open a Powershell terminal window
- Run
ssh-keygen -b 4096
- Enter the passphrase if desired, or hit Enter to continue without a passphrase
- To get the contents of your public key, run
get-content
against the full path of the newly created public key
PS C:\Users\Administrator> ssh-keygen -b 4096
Generating public/private rsa key pair.
Enter file in which to save the key (C:\Users\Administrator/.ssh/id_rsa):
Created directory 'C:\Users\Administrator/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in C:\Users\Administrator/.ssh/id_rsa.
Your public key has been saved in C:\Users\Administrator/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:Kmos01FGD1/vYliJRwOczRQtoVwOlnNUk1MLgxU0p1M administrator@company
The key's randomart image is:
+---[RSA 4096]----+
| .+O*OX+E |
| oo==X +O . |
|* = o.o=ooo= . |
|+O.o o o..o. |
| o +S. |
| . ..o . |
| o .. .. . |
|o +. . |
| +. |
+----[SHA256]-----+