Open ssh key management

Generating the public and private key

The public and private key pair can be generated easily. Open the terminal and type :

# ssh-keygen

This command will create a public key and private key in your ~/.ssh folder under the names id_rsa.pub and id_rsa respectively.

Installing the public key in the remote machine

Now you can give the public key to the public but not the private key. Suppose you want to access your machine from remote machine(192.168.0.XX) . In that case you have to install the public key in that machine.

scp <filename> <host>
eg: scp id_rsa.pub 192.168.0.XX:/home/asha/

You have to copy this file (id_rsa.pub) contents and append with another file called authorized_keys, which you will find in your ~./ssh directory (if not found create one file with this name). You can do this either by manually copying the contents and pasting in the file.

Otherwise you can log on to that machine from your machine and do :

cat “id_rsa.pub” >>~/.ssh/authorized_keys

Now you can check the file authorized_keys which will show your public key contents there(That means you are authorized to log into that system.)

Leave a Reply