Scenario: you want to log into the server from one location with one key and from other location with another key.

First i did this easy way between 2 linux servers: generated key with ssh-keygen, added public key to server with ssh-copy-id, tested and it was all working.

I have also windows machine at hand and i want to use putty to log into server along with different key. Little problem is that openssh and putty keys are not interoperable. You need to import private key generated with ssh-keygen into puttygen and convert this into putty format key.

So far so good until i tried logging into server and i got error message in putty saying “Server refused our key”. I tried several times over until i managed to find out that if you have more than one authenticated key then you need to add them to authenticated_keys2 not authenticated_keys.

There are 2 good pages also about this subject http://ornellas.apanela.com/dokuwiki/pub:ssh_key_auth and http://andremolnar.com/how_to_set_up_ssh_keys_with_putty_and_not_get_server_refused_our_key


Share on TumblrSubmit to StumbleUponSave on DeliciousDigg ThisSubmit to reddit