无法使用ssh-add加载私钥


0

我试图通过执行以下命令来创建ssh密钥:

ssh-keygen -t dsa

然后提示我输入商店路径:

Enter file in which to save the key (/Users/KesongXie/.ssh/id_dsa): id_dsa

输入密码后,我得到以下结果

Your identification has been saved in id_dsa.
Your public key has been saved in id_dsa.pub.

然后我尝试使用followibg命令加载我的私钥

ssh-add /Users/KesongXie/.ssh/id_dsa

它显示结果:

-bash: ssh-add/Users/KesongXie/.ssh/id_dsa: No such file or directory

当我导航到本地目录Users / KesongXie时,找不到.ssh文件(如预期的那样,doc文件被隐藏了),但是当我尝试在终端中查看它时,我键入

cd ~
pwd

我遇到了Users/KesongXie 并且很累ls,希望看到我的.ssh,但是它仍然不可见。然后我试图

cd .ssh

我发现我然后进入.ssh目录,使用ls,我可以看到以下结果:

github_rsa  github_rsa.pub  id_dsa      id_dsa.pub  known_hosts

密钥确实存储在.ssh文件夹中,但是我想知道为什么我不能使用以下命令加载私钥

ssh-add /Users/KesongXie/.ssh/id_dsa

尝试将您在帖子中输入的命令复制并粘贴到终端中。它应该工作。您一定是第一次将它输入错误到您的终端中。
BenjiWiebe 2014年

Answers:


1

-bash: ssh-add/Users/KesongXie/.ssh/id_dsa: No such file or directory是一个奇怪的错误消息-这意味着Bash认为您试图运行文字命令ssh-add/Users/KesongXie/.ssh/id_dsa。您确定在之后使用ASCII空格(0x20)ssh-add吗?

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.