Dre*_*lee 15 git ssh github heroku ssh-keys
我一直在扫描网络/ SO并阅读几个许可被拒绝请求帮助我只是找不到以我理解的方式解决我的问题.
我正在遵循这些说明(Heroku/Cedar上的Python入门).一切顺利,直到:
drewverlee@ubuntu:~/helloflask$ source venv/bin/activate
(venv)drewverlee@ubuntu:~/helloflask$ git push heroku master
The authenticity of host 'heroku.com (50.19.85.132)' can't be established.
RSA key fingerprint is ##:##:##:##:##:##:##:##:##:##:##:## (I replaced with #)
Are you sure you want to continue connecting (yes/no)? yes
Failed to add the host to the list of known hosts (/home/drewverlee/.ssh/known_hosts).
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
Run Code Online (Sandbox Code Playgroud)
(不确定安全性,所以我用(#)替换了键)
我想这可能是因为
drwx------ 2 root root 1024 2012-03-08 21:26 .ssh
Run Code Online (Sandbox Code Playgroud)
因为
drewverlee@ubuntu:~$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/drewverlee/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
open /home/drewverlee/.ssh/id_rsa failed: Permission denied.
Saving the key failed: /home/drewverlee/.ssh/id_rsa.
Run Code Online (Sandbox Code Playgroud)
作为在这些问题上缺乏经验的人,我不知道如何安全地撤消我已经安全的事情,因为我知道我正在干扰强大的工具.关于最新情况的任何建议?如果我需要包含更多信息来解决问题,请告诉我.
Mar*_*her 45
您应该拥有自己目录中.ssh目录的权限,但在您的情况下,它由root拥有.尝试
cd ~
sudo chown drewverlee .ssh
Run Code Online (Sandbox Code Playgroud)
然后重试创建密钥和连接.
Kok*_*cao 10
因为上面的答案都不适合我。我将发布我的答案:
如果您仍然记得密码并希望保留旧的 id_rsa,则使用RECOMMENDED SOLUTION
,否则转到NOT RECOMMENDED SOLUTION
。
chmod -c 0644 id_rsa.pub
chmod -c 0600 id_rsa
Run Code Online (Sandbox Code Playgroud)
sudo rm -rf ~/.ssh/id_rsa
sudo rm -rf ~/.ssh/id_rsa.pub
Run Code Online (Sandbox Code Playgroud)
为什么它有效:
sudo
是针对root的ssh,而不是针对用户的。这意味着ssh-add ~/.ssh/id_rsa
将无法将 root ssh 添加到用户。(如果有问题请让我修改我的答案。谢谢:)
由于某些原因, ~/.ssh 文件夹中的 id_rsa 文件对我的用户 (0400) 处于只读模式。我将其更改为读写(0600)
chmod 0600 id_rsa
Run Code Online (Sandbox Code Playgroud)
在我显然能够覆盖文件之后。我想这些是您可以授予此文件的最高权限,因为其他权限没有太大意义。
归档时间: |
|
查看次数: |
45796 次 |
最近记录: |