0

I've only worked with private keys when I was the one setting up for both servers. However, this time, I was given private keys to be used as password to login to the server from my local.

Anyone can help/show me how?

1
ssh -i /path/to/private/key remoteuser@remotehost

Note that the private key will need appropriate permissions (0600)

If you are on Windows, you'll probably want to use Putty, and when you create a new profile you'll be able to select a key. Note that your key may need be be converted to a different format (eg pem -> ppk) , but Putty has directions on that using the puttygen utility.

  • /path/to/private/key -- should this be in my local? – geneva Nov 17 '17 at 6:24
  • So when I open my SSH client, I will be loading the server. But I don't know how to connect to the server as it's using rsa key. I think this is my main dilemma. – geneva Nov 17 '17 at 6:31
  • If you are connecting from linux or a Mac, then the command I posted should work, and yes, /path/to/private/key would be on your local machine. If you are on Windows, you'll probably want to use Putty, and when you create a new profile you'll be able to select a key. Note that your key may need be be converted to a different format, but Putty has directions on that. – ivanivan Nov 17 '17 at 13:08
  • Yes, I figured it out. I can actually import the keys via the Putty configuration, however I have a .pem file and putty requires .ppk. So may need to convert using the putty gen. – geneva Nov 21 '17 at 1:34
  • @geneva exactly what you need to do. and it really helps us give good answers the first time if you tell us what OS you are connecting from in the question :) – ivanivan Nov 21 '17 at 2:29
0

You can also save the private key as ~/.ssh/id_rsa (0700 directory permissions and 0600 file permissions) and then ssh user@host.

It would be expected that on the other hose, your public key would be in the ~/.ssh/authorized_keys file.

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.