我正在尝试连接到 github,但收到权限被拒绝(公钥)错误。我生成了新的 id_rsa.pub 并将它们放在我在 github 的帐户中,但这没有帮助。然后我尝试创建新的 id_dsa.pub 和 id_dsa 密钥。ssh-keygen -t dsa
但是,当我尝试复制 id_dsa.pub 密钥时,我被告知目录不存在。
注意我使用的是 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 [email protected]
The key's randomart image is:
+--[ DSA 1024]----+
| |
| |
| |
| . . . |
| . o . +S |
|E o . *. |
|oo o =.+ |
| .+ + O.. |
| o.+.=.. |
+-----------------+
答案1
我认为除了 root 之外的任何人都无法遍历该目录(目录上未设置执行位)。
尝试首先获取 root shell,然后sudo -s
复制文件(并且您可能还想在完成后更改所有者。
所以:
$ sudo -s
# cp /var/root/.ssh/id_dsa.pub DESTINATION
# chown USER:USER DESTINATION
# exit
$ cat DESTINATION