question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot perform ssh public key authentication from codeserver terminal.

See original GitHub issue

OS/Web Information

  • Web Browser:Google Chrome 90.0.4430.85(Official Build)
  • Local OS: Windows10 20H2 (19042.928)
  • Remote OS: Debian GNU/Linux 10 (buster)
  • Remote Architecture: Linux server1 4.19.0-16-amd64 #1 SMP Debian 4.19.181-1 (2021-03-19) x86_64 GNU/Linux
  • code-server --version: 3.9.3 fe2dc2deb08e378069891b622bb62ad1d261d1b1

Steps to Reproduce

1.Execute ssh -T github. 2.An error will be displayed.

sign_and_send_pubkey: signing failed: agent refused operation
git@github.com: Permission denied (publickey).

Expected

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.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
penM000commented, 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

server@server1:~$ env | grep SSH
SSH_CONNECTION=ip_address 51240 ip_address 22
SSH_CLIENT=ip_address 22
SSH_TTY=/dev/pts/4

code server shell

server@server1:~$ env | grep SSH
SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
SSH_AGENT_PID=6733

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.
1reaction
code-ashercommented, Apr 23, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot perform ssh public key authentication from codeserver ...
Open terminal; Run ssh-keygen and enter a password; Add key to github.com; ssh -T git@github.com ...
Read more >
Remote Development Tips and Tricks - Visual Studio Code
Quick start: Using SSH keys. To set up SSH key based authentication for your remote host. First we'll create a key pair and...
Read more >
Trying to do ssh authentication with key files: server refused ...
load the private key in the PuTTY profile; enter the public key in ~/.ssh/authorized_keys in one line ( ssh-rsa {your_public_key} with no more...
Read more >
Usage - code-server v4.8.0 docs - Coder
SSH into your instance and edit the code-server config file to disable password authentication: · Restart code-server: · Forward local port 8080 to...
Read more >
VS Code SSH Remote Connection issues - Stack Overflow
The key info is provided at the line. [17:09:22.713] > Acquiring lock on ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found