Search Our Database

How to Generate Your SSH Public Key

Last updated on |

In order to generate your SSH public key, you will need to generate the private key, in order to do that you may refer to the following steps:-

Step 1: SSH to the server with root privilege.


Step 2: Once you already SSH to the server, you may go to the following path:-

# cd ~/.ssh
# ls


Step 3: Once you already at the path “/.ssh“, you may generate the key using the command as below:-

# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/schacon/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/schacon/.ssh/id_rsa.
Your public key has been saved in /Users/schacon/.ssh/
The key fingerprint is:
43:c5:5b:5f:b1:f1:50:43:ad:20:a6:92:6a:1f:9a:3a schacon@agadorlaptop.local

It will show the request as above, just press ENTER until it finishes.


Step 4: Once the steps have been done, you will generate a private and public key. The public key will be the one with “.pub”:-

If someone requested the public key to access your server, all you have to do is copy the contents of the .pub file and e-mail it. The public keys look something like this :-

# cat ~/.ssh/
NrRFi9wrf+M7Q== schacon@agadorlaptop.local

Now you have done generate the public key. Copy the public key and send it to the user that requests it.