Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I was cloning a github repository. I copied my id_rsa key from another pc to my /home/me/.ssh/ however this error shows up

Permission denied (publickey,gssapi-with-mic).

how would I solve this issue?

share|improve this question
    
Don't copy the key file directly, use ssh-copy-id instead. –  terdon Jun 19 '13 at 13:34
    
after that? should I do? –  user962206 Jun 19 '13 at 13:37
add comment

2 Answers 2

You need to put the contents of id_rsa.pub in the file /home/me/.ssh/authorized_keys.

id_rsa is your private key and should be protected carefully.

share|improve this answer
    
I don't see any authorized_keys under my .ssh folder. should I make it? –  user962206 Jun 19 '13 at 13:31
    
Yes, that file has to exist and contain your trusted public key(s). –  Flup Jun 19 '13 at 13:42
    
how would I do/create that? I don't know the format –  user962206 Jun 19 '13 at 13:45
    
Just copy id_rsa.pub from the client machine to the server, and rename it as /home/me/.ssh/authorized_keys. –  Flup Jun 19 '13 at 13:47
    
I have no access to the server.I just did a fresh install of ubuntu. and copied the id_rsa and id_rsa.pub from my windows 7 machine to ubuntu. –  user962206 Jun 19 '13 at 13:51
show 4 more comments

You shouldn't just copy the key around. Create a new key for the machine you are using in the same way as you created the one you are copying. According to this page, you should do:

  1. Create the key

    ssh-keygen -t dsa
    
  2. Copy the content of id_dsa.pub file and append it to the target machine's .ssh/authorized_keys file. If authorized_keys file is not accessible, then just create .ssh/authorized_keys2 file and paste the key.

    cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
    
  3. Copy the key to the target machine

    ssh-agent sh -c 'ssh-add < /dev/null && bash'
    
share|improve this answer
    
ssh-copy-id does the same thing: once the key is in place, you can just ssh-copy-id username@host. –  Flup Jun 19 '13 at 13:59
    
what about may old ssh key? will I still be use it? –  user962206 Jun 19 '13 at 13:59
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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