Generating RSA Keys

1. Create a folder called “.ssh” under the root folder (change ~ for the full path of the user if you are using a user account)

2. Change permissions on the “.ssh” folder to 700

3. Generate keys

You will be prompted for a location to save the keys and a passphrase for the keys. The passphrase will protect your private key while it’s stored on the hard drive of the client machine but will be required every time you try and log in using a key-based system.

The default key encryption level is 2048 bits, you can increase this to 4096 bits with the -b flag (increasing the bits makes it harder to crack the key by brute force methods).


The keys will now be available as at ~/.ssh/ and ~/.ssh/id_rsa

4. Create a file called “authorized_keys” in the ~/.ssh folder

5. Copy the contents of to authorized_keys

Transfer Public Key


6. Copy the contents of the id_rsa file to the client


7. Create a file called id_rsa in ~/.ssh/

8. Paste contents (as example only)

9. Change permissions on id_rsa

10. Connect to the server

All going well, you shouldn’t be prompted for a password

Adding Additional Keys

11. Follow steps 1 to 5 to create keys on the new server

12. On the client, create a file called “config” in the ~/.ssh folder

13. Paste the following into the config file

Change example1 and example2 to the servers you are connecting to.
Make sure key files are chmod 400
You can have as many entries as you want in here

Should you have any questions, comments or suggestions, please don’t hesitate to comment below. If you like what you have read, please share it on your favourite social media medium.

Leave a Reply

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

Time limit is exhausted. Please reload CAPTCHA.