VSC Remote SSH ForwardAgent only works first time
I use 1Password to manage SSH-Keys and it works well.
Today i noticed a strange behavior when i use VSC Remote SSH and open another SSH connection in VSC terminal (with ForwardAgent yes). When i try this directly after the .vscode-server is new installed on the remote, everything works as expected, 1Password opens, i authorize and the SSH connection works.
But after closing VSC and connecting again to the remote host (this works perfectly), the SSH authentication in a terminal window doesn't work: "Permission denied (publickey)". I don't get the 1Password prompt and the logs say get_agent_identities: ssh_get_authentication_socket: No such file or directory
.
When i delete the .vscode-server directory on the remote, and it is reinstalled in a new connection, everything works perfectly. But it works just until I close and reopen VSC.
The OS on my remote machine is Debian 12.
Comments
-
I figured out how to fix this issue. It was not a problem with 1Password, but with VS Code. The variable
$SSH_AUTH_SOCK
wasn't updated after reconnecting to the host and pointed to the old path.To fix this, change the setting
Remote.SSH: Use Exec Server
to false in VSC.Original post that helped me: https://github.com/microsoft/vscode-remote-release/issues/9819
1