SSH Keys Guide


Generating SSH Keys  1

Accessing servers using SSH Keys  1

Adding key configuration to config  1


Generating SSH Keys

1.Open Terminal
2.Command: ssh-keygen -t ed25519 -C “
3.Enter a filename to save your key in and it will create private and public keys with different extensions.
4.Type a secure passphrase when prompted. You can skip this by pressing enter but this is not the most secure way.
5.Retype passphrase when prompted (Do not forget this as it will be needed while connecting to the machine. You have to remember this paraphrase but this will be same for any machine you connect as long as you use the same ssh key pair)
6.Check if your ssh keys exist in .ssh directory

Accessing servers using SSH Keys

1.Share your public key ( with the person who is going to grant access so he/she can add to it the authorized keys folder on the server where access is to be granted to you. Never share the private key with anyone but we suggest storing it on Google drive.
2.Connect to host: ssh -i .ssh/<private_key_filename> <user>@<host>


Alternatively you can add configurations to make the process quicker

Adding key configuration to config

1.Create a file in .ssh directory called config
2.Sample entry –

Host <hostname>

  IdentityFile ~/.ssh/<private_key_filename>

  HostName <hostname>

  User <user>

3.This can also be used for GitHub SSH Keys



  User git

  IdentityFile ~/.ssh/id_rsa_<username>

  IdentitiesOnly yes

  AddKeysToAgent yes

  UseKeychain yes


Note: You might have to create multiple keys if you have multiple GitHub accounts.

See more on this :

All search results