Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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 am trying to connnect to github, but am getting a Permission denied (publickey) error. I generated new and put them in my account at github, but this didn't help. I then tried to create new and id_dsa keys, ssh-keygen -t dsa. However, when I go to try to copy the key I am told the directory does not exist.

Note I am using Mac OSX

skline-mac:first_app skline$ sudo ssh-keygen -t dsaPassword:
Generating public/private dsa key pair.
Enter file in which to save the key (/var/root/.ssh/id_dsa): 
/var/root/.ssh/id_dsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /var/root/.ssh/id_dsa.
Your public key has been saved in /var/root/.ssh/
The key fingerprint is:
ba:26:95:3e:11:bb:b7:32:01:ae:14:fe:d9:2a:03:0e root@skline-mac.local
The key's randomart image is:
+--[ DSA 1024]----+
|                 |
|                 |
|                 |
|  . . .          |
| . o . +S        |
|E o . *.         |
|oo o =.+         |
| .+ + O..        |
|   o.+.=..       |
share|improve this question
Can you paste the exact commands you used and the output into your question? Please indent each line by 4 spaces so that it is formatted correctly. – Mikel Feb 20 '11 at 1:55
Why are you generating keys as root? Why can't you just generate keys as your own user, where it will just make the file at /home/username/.ssh/? – Shane Feb 20 '11 at 2:57
Good call; I had just assumed he was generating the key for root. – Tyler Szabo Dec 9 '11 at 20:03
up vote 1 down vote accepted

I'm thinking that the directory isn't traversable for anybody but root (execute bit isn't set on the directory).

Try first getting a root shell, with sudo -s then copying the file (and you may also want to change owners after you do.


$ sudo -s
# cp /var/root/.ssh/ DESTINATION
# exit
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .