programing tip

“sign_and_send_pubkey : 서명 실패 : 에이전트가 작업을 거부했습니다”를 해결하는 방법은 무엇입니까?

itbloger 2020. 11. 16. 07:54
반응형

“sign_and_send_pubkey : 서명 실패 : 에이전트가 작업을 거부했습니다”를 해결하는 방법은 무엇입니까?


SSH 키로 새로운 Digital Ocean 물방울을 구성합니다. 내가 실행 ssh-copy-id하면 이것이 얻는 것입니다.

ssh-copy-id user@012.345.67.89
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
sign_and_send_pubkey: signing failed: agent refused operation
user@012.345.67.89's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'user@012.345.67.89'"
and check to make sure that only the key(s) you wanted were added.

그러나 ssh를 시도하면 다음과 같은 일이 발생합니다.

ssh user@012.345.67.89
sign_and_send_pubkey: signing failed: agent refused operation
user@012.345.67.89's password: 

암호를 입력하면 로그인 상태가 좋지만 이것은 당연히 SSH 키를 만드는 목적에 위배됩니다. 나는 ssh-agent 서버 측을 살펴보기로 결정했으며 여기에 내가 얻는 것이 있습니다.

user@012.345.67.89:~# eval `ssh-agent -s`
Agent pid 5715
user@012.345.67.89:~# ssh-add -l
The agent has no identities.

user / .ssh / authorized_keys는 ssh-rsa 키 항목도 포함하지만 find -name "keynamehere"아무것도 반환하지 않습니다.


ssh-add클라이언트 머신에서 실행 하면 에이전트에 SSH 키가 추가됩니다.

ssh-add -l(클라이언트에서 다시) 실제로 추가 되었는지 확인 합니다.


Fedora 26을 28로 업그레이드 한 후에도 동일한 문제가 발생했습니다. 그리고 다음 로그가 누락되었습니다.

/var/log/secure
/var/log/messages

발행물:

antop@localmachine  ~  ssh root@ocp1.example.com
sign_and_send_pubkey: signing failed: agent refused operation
root@ocp1.example.com's password:

오류 메시지가 실제 문제를 가리 키지 않습니다. 해결 된 문제

chmod 700 ~/.ssh
chmod 600 ~/.ssh/*

Linux Ubuntu 18 에서 동일한 문제가 발생했습니다 . Ubuntu 17.10 에서 업데이트 한 후 모든 git 명령이 해당 메시지를 표시합니다.

이 문제를 해결하는 방법은 id_rsa에 대한 올바른 권한이 있는지 확인하는 것 id_rsa.pub입니다.

를 사용하여 현재 chmod 번호를 확인하십시오 stat --format '%a' <file>. 이 있어야 600id_rsa644id_rsa.pub.

파일 사용 권한을 변경하려면

chmod 600 id_rsa
chmod 644 id_rsa.pub

업데이트로 내 문제가 해결되었습니다.


gpg-agent를 ssh-agent로 사용하고 gpg 하위 키를 ssh 키 https://wiki.archlinux.org/index.php/GnuPG#gpg-agent 로 사용할 때 오류가 발생했습니다 .

내 sway 구성에 사용 된 sleep + lock 명령으로 인해 gpg에 대한 잘못된 핀 항목 tty가 발생하여 문제가 발생한 것으로 의심됩니다.

bindsym $mod+Shift+l exec "sh -c 'gpg-connect-agent reloadagent /bye>/dev/null; systemctl suspend; swaylock'"

또는 잠자기 / 일시 중지

핀 항목 tty를 재설정하여 문제를 해결하십시오.

gpg-connect-agent updatestartuptty /bye > /dev/null

내 sway sleep + lock 명령 수정 :

bindsym $mod+Shift+l exec "sh -c 'gpg-connect-agent reloadagent /bye>/dev/null; systemctl suspend; swaylock; gpg-connect-agent updatestartuptty /bye > /dev/null'"


이 오류에 대해 :

# git pull
sign_and_send_pubkey: signing failed: agent refused operation
git@github.com: Permission denied (publickey).    
fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

Github 계정> 프로필> ssh에서 공개 키를 확인하거나 다시 추가합니다.

나는 다음과 같이 해결했다.

# chmod 400 ~/.ssh/id_rsa

# ls  ~/.ssh/id_rsa -ls  
4 -r--------. 1 reinaldo reinaldo 1679 Jul 26  2017 /home/reinaldo/.ssh/id_rsa

# git pull                                 
remote: Counting objects: 35, done.
remote: Compressing objects: 100% (19/19), done.
remote: Total 35 (delta 9), reused 34 (delta 9), pack-reused 0
Unpacking objects: 100% (35/35), done.

감사합니다.


SSH 오류가 발생하는 데는 여러 가지 이유가있을 수 있습니다.

sign_and_send_pubkey : 서명 실패 : 에이전트가 작업을 거부했습니다.

그들 중 일부는 다른 답변 (이 스레드 답변 참조)에 의해 강조된 문제와 관련이있을 수 있으며, 일부는 숨겨 질 수 있으므로 면밀한 조사가 필요합니다.

제 경우에는 다음과 같은 오류 메시지가 나타납니다.

sign_and_send_pubkey : 서명 실패 : 에이전트가 작업을 거부했습니다.

user@website.domain.com : 권한 거부 됨 (publickey, gssapi-keyex, gssapi-with-mic)

The only way to find the real problem was to invoke the -v verbose option which resulted in printing a lot of debugging info:

debug1: Connecting to website.domain.com [xxx.xxx.xxx.xxx] port 22.
debug1: Connection established.
debug1: identity file /home/user/.ssh/id_rsa.website.domain.com type 0
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_rsa.website.domain.com-cert type -1

Please note that the line saying key_load_public: No such file or directory is referring the next line and not the previous line.

So what SSH really says is that it could not find the public key file named id_rsa.website.domain.com-cert and that seemed to be the problem in my case since my public key file did not contain the -cert suffix.

Long story short: the fix in my case was just to make sure that the public key file was named as expected. I could never suspected that without debugging the connection.

The bottom line is USE THE SSH VERBOSE MODE (-v option) to figure out what is wrong, there could be various reasons, none that could be found on this/another thread.


This should be rather a SuperUser question.

Right I have the exact same error inside MacOSX SourceTree, however, inside a iTerm2 terminal, things work just dandy.

However, the problem seemed to be that I've got two ssh-agents running ;(

The first being /usr/bin/ssh-agent (aka MacOSX's) and then also the HomeBrew installed /usr/local/bin/ssh-agent running.

Firing up a terminal from SourceTree, allowed me to see the differences in SSH_AUTH_SOCK, using lsof I found the two different ssh-agents and then I was able to load the keys (using ssh-add) into the system's default ssh-agent (ie. /usr/bin/ssh-agent), SourceTree was working again.


Yes. Run ssh-add on the client machine. Then repeat command ssh-copy-id userserver@012.345.67.89


For me the problem was a wrong copy/paste of the public key into Gitlab. The copy generated an extra return. Make sure what you paste is a one-line key.


I got a sign_and_send_pubkey: signing failed: agent refused operation error as well. But in my case the problem was a wrong pinentry path.

In my ${HOME}/.gnupg/gpg-agent.conf the pinentry-program property was pointing to an old pinentry path. Correcting the path there and restarting the gpg-agent fixed it for me.

I discovered it by following the logs with journalctl -f. There where log lines like the following containing the wrong path:

Jul 02 08:37:50 my-host gpg-agent[12677]: ssh sign request failed: No pinentry <GPG Agent>
Jul 02 08:37:57 my-host gpg-agent[12677]: can't connect to the PIN entry module '/usr/local/bin/pinentry': IPC connect call failed

참고URL : https://stackoverflow.com/questions/44250002/how-to-solve-sign-and-send-pubkey-signing-failed-agent-refused-operation

반응형