Ubuntu – How to add Windows SSH key file to Ubuntu 16.04

ssh

At my work I have to ssh into our development server.

I used my windows partition to provide an ssh which they added to their authentication list. But now that I have my Linux partition up and running I wanted to add that. Now after speaking with them they only want to have my 1 ssh key set on the server so I would have to add that same key to my Ubuntu 16.04 partition.

I've tried bringing the id_rsa and id_rsa.pub files over and attempting to ssh into the server but to no avail.

I simply copied the id_rsa and id_rsa.pub files to an email and sent to myself and placed in a directory home/keys. I'm sure this is not the correct location to place them but I do not know how to access the ssh directory on ubuntu.

Is there a way to add these files to my ssh directory on Ubuntu? or if that would fix the issue?

I know I can create new ssh keys but that defeats the purpose of what I am trying to do.

Any help is greatly appreciated, thank you.

Best Answer

Both files should be placed in the directory /home/{user}/.ssh, if you find this directory doesn't exist, you can make it with the correct permission with the command:

mkdir -m700 ~/.ssh

Move both the public and private keyfiles into that directory (using the directory /home/keys that you wrote in your question):

mv /home/keys/id_rsa* ~/.ssh

Make sure that the keys have the correct permissions and ownership:

chown {user}:{user} ~/.ssh/id_rsa*
chmod 600 ~/.ssh/id_rsa
chmod 644 ~/.ssh/id_rsa.pub
Related Question