Ubuntu – Private/Public key authentication not working after reinstalling ubuntu

authenticationserverssh

I backed up my ~/.ssh folder and reinstalled ubuntu 13.10 on my machine. Then I just copied the .ssh folder back into my home folder and tried to connect to my server. I'm getting the following error: "Permission denied (publickey).". This is my .ssh folder on the client machine:

drwx------  2 user group 4096 Feb 25 21:21 . drwxr-xr-x 24 user group 4096 Feb 27 10:48 ..
-rw-r--r--  1 user group 1992 Feb  4 08:08 known_hosts
-rw-------  1 user group 3326 Nov 25 17:37 key
-rw-r--r--  1 user group 747 Nov 25 17:37 key.pub

Everything was working fine before the new installation. Do I have to somehow register the private key at the client machine? The server is a 12.04.

Best Answer

ssh search for private keys in the following mode .ssh/id_rsa && .ssh/id_dsa and .ssh/id_ecdsa in newer ssh versions.

but your private key has an alternative name, so you need to use ssh with -i option

try to connect using this command ssh -vvv -i .ssh/key remoteserver