我想使用两个使用公钥身份验证的不同服务,而不必总是输入我的密码短语。
我想要的:
git pullgcloud [...] ssh [...]。截至今天:
git pull不要求我输入我的凭据,它们存储在~/.ssh/id_rsa和~/.ssh/id_rsa.pub中。gcloud ... ssh ...总是让我输入密码:金云..。嘘..。sign_and_send_pubkey:签名失败:代理拒绝操作,为key‘/home/BeChillerToo/..ssh/google输入密码:
这是我的~/.ssh/config的内容:
IdentityFile ~/.ssh/google
IdentityFile ~/.ssh/id_rsa以及/etc/ssh/ssh_config的内容:
Host *
PasswordAuthentication yes
SendEnv LANG LC_*
HashKnownHosts yes
GSSAPIAuthentication yes编辑:我的键似乎添加得很糟糕。
下面是引导后的ssh-add -l的结果:
2048 SHA256:+nCvs...CUM+DHqA4 chill@laptop (RSA)
4096 SHA256:bTgKQM...ok chill@gmail.com (RSA)
4096 SHA256:92d3Wy...jc chill@work-mail.com (RSA)然后在我添加google-compute-engine键之后:
2048 SHA256:+nCvs...CUM+DHqA4 /home/chill/.ssh/google_compute_engine (RSA)
4096 SHA256:bTgKQM...ok chill@gmail.com (RSA)
4096 SHA256:92d3Wy...jc chill@work-mail.com (RSA)与chill@work-mail.com相关的关键是我为Github使用的密钥,因此我不必向git pull提供凭据。
我怀疑第一个键(从chill@laptop切换到/home/chill/.ssh/google_compute_engine)是导致gcloud出现问题的键:
$ gcloud compute ... ssh ...
sign_and_send_pubkey: signing failed: agent refused operation
Enter passphrase for key '/home/chill/.ssh/google_compute_engine': 发布于 2019-01-17 15:11:03
使用ssh-代理。在X环境中,GNOME键环或KDE钱包可以自动处理密钥。在控制台环境中,启动ssh-agent如下所示:
$ eval $(ssh-agent)
## The output without the eval will look like this:
$ ssh-agent
ssh-agent
SSH_AUTH_SOCK=/tmp/ssh-hvcwJQnSOHOi/agent.125894; export SSH_AUTH_SOCK;
SSH_AGENT_PID=125895; export SSH_AGENT_PID;
echo Agent pid 125895;启动ssh-agent之后(使用eval)。可以使用ssh-添加添加SSH键。
$ ssh-add ~/.ssh/google
$ ssh-add ~/.ssh/id_rsa对于当前版本的SSH,还可以将选项AddKeysToAgent添加到~/.ssh/config文件中:
## ~/.ssh/config
AddKeysToAgent yes如果设置了环境变量SSH_AUTH_SOCK和SSH_AGENT_PID,这将自动向代理添加密钥。
还请检查此帖子是否存在签名_和_发送_公钥:签名失败:代理拒绝操作错误。
发布于 2019-06-27 15:47:28
一个@Simon Sudler的答案和另一个答案的组合:
1. Your home directory ~, your ~/.ssh directory and the ~/.ssh/authorized_keys file on the remote machine must be writable only by you: rwx------ and rwxr-xr-x are fine, but rwxrwx--- is no good¹, even if you are the only user in your group (if you prefer numeric modes: 700 or 755, not 775).
2. If ~/.ssh or authorized_keys is a symbolic link, the canonical path (with symbolic links expanded) is checked.
Your ~/.ssh/authorized_keys file (on the remote machine) must be readable (at least 400), but you'll need it to be also writable (600) if you will add any more keys to it.
3. Your private key file (on the local machine) must be readable and writable only by you: rw-------, i.e. 600.(权限回答具体而言)
很快就解决了我的问题。
https://askubuntu.com/questions/1110546
复制相似问题