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/ :/tmp/

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

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

Leave a Reply

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