How to Generate Your SSH Public Key

< Back to the Title Topic

How to Generate Your SSH Public Key

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
known_hosts

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/id_rsa.pub.

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/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAklOUpkDHrfHY17SbrmTIpNLTGK9Tjom/BWDSU
GPl+nafzlHDTYW7hdI4yZ5ew18JH4JW9jbhUFrviQzM7xlELEVf4h9lFX5QVkbPppSwg0cda3
Pbv7kOdJ/MTyBlWXFCR+HAo3FXRitBqxiX1nKhXpHAZsMciLq8V6RjsNAQwdsdMFvSlVK/7XA
t3FaoJoAsncM1Q9x5+3V0Ww68/eIFmb1zuUFljQJKprrX88XypNDvjYNby6vw/Pb0rwert/En
mZ+AW4OZPnTPI89ZPmVMLuayrD2cE86Z/il8b+gw3r3+1nKatmIkjn2so1d01QraTlMqVSsbx
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.

Previous How To SSH Into Your Cloud