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

1 Answer

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.

So:

$ sudo -s
# cp /var/root/.ssh/id_dsa.pub DESTINATION
# chown USER:USER DESTINATION
# exit
$ cat DESTINATION
share|improve this answer
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.