How to ssh into a server when your ssh key file is not named id_rsa

When you want to ssh into a server, and you didn’t name your private key file id_rsa, all you need to do to make ssh work is to specify the location of your private key file with the -i option of the ssh command:

$ ssh -i ~/.ssh/my_key_file username@servername

I just tested that and it works fine. The man page for the scp command shows that it also uses the -i option to specify the private key file. That’s actually my reason for using this technique, I want to scp a file to a Raspberry Pi device I have on my network, so I now use this command to make that happen:

$ scp -i ~/.ssh/rpi_rsa pi@

I originally wrote about the process of configuring your client and server to ssh login without a password, and I can confirm that that tutorial still works, but I didn’t write about this process at that time. You can find more information about this at