I need to connect to my web host via SSH. I created a public and private SSH key on the web host then downloaded the private key (id_rsa). I have no idea where I should put the private key on my computer or what the proper SSH command should look like. I've searched the web but everything I've found is confusing. I'm running a recent version of Linux Mint (Ubuntu based). Can someone help me out?

Thanks in advance


You should create both keys locally, and only move the public key. The private key is private, it should be known by only one device. But if you can completely trust the remote, or if you will not use the key for anything else, and you transferred it securely, then it does not matter.

The private key goes in local

The private key goes in ~/.ssh, on the local machine. You can load it with ssh-add ~/.ssh/keyname, if you use default names then ssh-add is enough.

The public key goes in the remote

#do once
mkdir ~/.ssh/public-keys
cp -t ~/.ssh/public-keys ~/.ssh/authorized_keys

#do for each key
cp -t ~/.ssh/public-keys the-public-key
cat ~/.ssh/public-keys/* >~/.ssh/authorized_keys

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.