How to create private/public ssh keys in Linux

If you want to use ssh to access different servers in your network but you don’t want to always type your password, then follow these steps:

ssh-keygen -b 2048 -t rsa -f ~/.ssh/id_rsa

Now copy your public ssh key to the server you want to access remotely:

Example: scp ~/.ssh/id_rsa.pub :/tmp/

Now login to the server and add the id_rsa.pub key to ~/.ssh/authorized_keys

cat /tmp/id_rsa.pub >> ~/.ssh/authorized_keys
rm /tmp/id_rsa.pub

Leave a Reply

Your email address will not be published. Required fields are marked *