Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was cloning a Git repository and I had copied my id_rsa key from another PC to my /home/me/.ssh/ on Ubuntu 12.04, 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

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 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/ >> ~/.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

You need to put the contents of 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 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 from my windows 7 machine to ubuntu. – user962206 Jun 19 '13 at 13:51

Your Answer


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.