You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cannot perform ssh public key authentication from codeserver terminal. #3189
Expect to get a response like ssh or COCKPIT(WEBSHELL) as follows
Enter passphrase for key '/home/server/.ssh/id_rsa':
Hi penM000! You've successfully authenticated, but GitHub does not provide shell access.
Solution
It works properly by discarding the environment variables as follows.
server@server1:~$ ssh -T github
sign_and_send_pubkey: signing failed: agent refused operation
git@github.com: Permission denied (publickey).
server@server1:~$ sudo -E -u `whoami` ssh -T github
sign_and_send_pubkey: signing failed: agent refused operation
git@github.com: Permission denied (publickey).
server@server1:~$ sudo -u `whoami` ssh -T github
Enter passphrase for key '/home/server/.ssh/id_rsa':
Hi penM000! You've successfully authenticated, but GitHub does not provide shell access.
or
server@server1:~$ sudo su root
root@server1:/home/server# su server
server@server1:~$ ssh -T github
Enter passphrase for key '/home/server/.ssh/id_rsa':
Hi penM000! You've successfully authenticated, but GitHub does not provide shell access.
The problem is that it doesn't even go to the state of entering a password. Therefore, we believe that the private key is not being loaded.
This problem occurred after updating codeserver from 3.8.0 and below to 3.9.3.
Are you using ssh-agent? If the SSH_AUTH_SOCK environment variable exists then unsetting it might cause it to ask for the password normally. Something like:
SSH_AUTH_SOCK= ssh -T github
If that doesn't help then using ssh -vvv might reveal more information.
By deleting SSH_AUTH_SOCK in codeserver's shell, it worked fine.
I wrote unset in the bashrc, and the codeserver shell was restored.
Thank you very much for your advice!
server@server1:~$ ssh -T github
sign_and_send_pubkey: signing failed: agent refused operation
git@github.com: Permission denied (publickey).
server@server1:~$ unset SSH_AUTH_SOCK
server@server1:~$ ssh -T github
Enter passphrase for key '/home/server/.ssh/id_rsa':
Hi penM000! You've successfully authenticated, but GitHub does not provide shell access.
Hurrah! ssh-agent is probably trying to use a graphical pinentry which of course won't work on the terminal.
I'm not sure if there's anything we can do on our end to fix it but it would be cool if we could make ssh-agent ask for the passphrase through VS Code.
Activity
code-asher commentedon Apr 22, 2021
I suppose it must be failing to ask for the password. Have you configured it to use some other method of pinentry?
I was unable to reproduce with this:
docker run -p 8080:8080 codercom/code-serverssh-keygenand enter a passwordssh -T git@github.compenM000 commentedon Apr 23, 2021
The problem is that it doesn't even go to the state of entering a password. Therefore, we believe that the private key is not being loaded.
This problem occurred after updating codeserver from 3.8.0 and below to 3.9.3.
penM000 commentedon Apr 23, 2021
2021-04-23.09-35-21.mp4
code-asher commentedon Apr 23, 2021
Are you using ssh-agent? If the
SSH_AUTH_SOCKenvironment variable exists then unsetting it might cause it to ask for the password normally. Something like:If that doesn't help then using
ssh -vvvmight reveal more information.penM000 commentedon Apr 24, 2021
As you mentioned, I made sure that the ssh-agent command was available.
I also confirmed that SSH_AUTH_SOCK exists only on codeserver, as shown below.
ssh shell
code server shell
By deleting SSH_AUTH_SOCK in codeserver's shell, it worked fine.
I wrote unset in the bashrc, and the codeserver shell was restored.
Thank you very much for your advice!
code-asher commentedon Apr 26, 2021
Hurrah! ssh-agent is probably trying to use a graphical pinentry which of course won't work on the terminal.
I'm not sure if there's anything we can do on our end to fix it but it would be cool if we could make ssh-agent ask for the passphrase through VS Code.
stale commentedon Oct 27, 2021
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no activity occurs in the next 5 days.
Bryce-huang commentedon Jul 14, 2023
chmod 600 your_private_key, it fixed my problem