Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing username when the config remote.ssh.configFile is empty #10684

Closed
6 tasks done
zWingz opened this issue Feb 7, 2025 · 13 comments
Closed
6 tasks done

missing username when the config remote.ssh.configFile is empty #10684

zWingz opened this issue Feb 7, 2025 · 13 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug ssh Issue in vscode-remote SSH

Comments

@zWingz
Copy link

zWingz commented Feb 7, 2025

Is there an existing issue for this bug?

  • I have searched the existing open issues and found none that apply.
  • If I find any issue of interest that is related or closed, I will included a link to it in this issue.

Required Troubleshooting Steps

  • I have read and performed the troubleshooting steps
  • I have tried both values of the remote.SSH.useLocalServer setting
  • My issue was not covered in the Tips and Tricks linked from the Troubleshooting Wiki.
  • I will include a complete copy of my Remote - SSH logs by running Remote-SSH: Show Log in the command palette or from View > Output in the menu bar

[Optional] Diagnose with Copilot

I did not ask the @remote-ssh participant for help

In step 2 of the troubleshooting wiki, what was the result of running the generated SSH command verbatim outside of VS Code?

I did not try step 2 of the troubleshooting steps

Remote-SSH Log

Remote-SSH Log

[14:38:14.283] Log Level: 2
[14:38:14.294] VS Code version: 1.97.0
[14:38:14.294] Remote-SSH version: [email protected]
[14:38:14.294] darwin arm64
[14:38:14.308] SSH Resolver called for "ssh-remote+7b2275736572223a22776f726b7370616365376338666333357877726475707475626c30222c22776f726b73706163654964223a22776f726b7370616365376338666333357877726475707475626c30222c22686f73744e616d65223a22677a2d476f6e6766656e67494445222c22656e76223a2270726f227d", attempt 1
[14:38:14.310] remote.SSH.useLocalServer = true
[14:38:14.310] remote.SSH.useExecServer = true
[14:38:14.310] remote.SSH.bindHost = {}
[14:38:14.310] remote.SSH.path = undefined
[14:38:14.310] remote.SSH.configFile = undefined
[14:38:14.310] remote.SSH.useFlock = true
[14:38:14.310] remote.SSH.lockfilesInTmp = true
[14:38:14.310] remote.SSH.localServerDownload = auto
[14:38:14.311] remote.SSH.remoteServerListenOnSocket = false
[14:38:14.311] remote.SSH.defaultExtensions = ["dbaeumer.vscode-eslint","EditorConfig.EditorConfig","eamodio.gitlens","oouo-diogo-perdigao.docthis","streetsidesoftware.code-spell-checker","xabikos.JavaScriptSnippets","aaron-bond.better-comments","csstools.postcss","donjayamanne.githistory","esbenp.prettier-vscode","DavidAnson.vscode-markdownlint","bradlc.vscode-tailwindcss","redhat.vscode-yaml"]
[14:38:14.311] remote.SSH.defaultExtensionsIfInstalledLocally = []
[14:38:14.311] remote.SSH.loglevel = 2
[14:38:14.311] remote.SSH.enableDynamicForwarding = true
[14:38:14.311] remote.SSH.enableRemoteCommand = false
[14:38:14.311] remote.SSH.serverPickPortsFromRange = {}
[14:38:14.311] remote.SSH.serverInstallPath = {}
[14:38:14.311] remote.SSH.permitPtyAllocation = false
[14:38:14.311] remote.SSH.preferredLocalPortRange = undefined
[14:38:14.312] remote.SSH.useCurlAndWgetConfigurationFiles = false
[14:38:14.312] remote.SSH.experimental.chat = false
[14:38:14.312] remote.SSH.experimental.enhancedSessionLogs = false
[14:38:14.327] SSH Resolver called for host: gz-GongfengIDE
[14:38:14.327] Setting up SSH remote "gz-GongfengIDE"
[14:38:14.332] Acquiring local install lock: /var/folders/kq/syf5l_d96z5dyq5ks2sdn2xh0000gn/T/vscode-remote-ssh-125018c4-install.lock
[14:38:14.332] Looking for existing server data file at /Users/zwing/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-125018c4-33fc5a94a3f99ebe7087e8fe79fbe1d37a251016-0.117.0-es/data.json
[14:38:14.333] No existing data file
[14:38:14.333] Using commit id "33fc5a94a3f99ebe7087e8fe79fbe1d37a251016" and quality "stable" for server
[14:38:14.333] Extensions to install: dbaeumer.vscode-eslint, EditorConfig.EditorConfig, eamodio.gitlens, oouo-diogo-perdigao.docthis, streetsidesoftware.code-spell-checker, xabikos.JavaScriptSnippets, aaron-bond.better-comments, csstools.postcss, donjayamanne.githistory, esbenp.prettier-vscode, DavidAnson.vscode-markdownlint, bradlc.vscode-tailwindcss, redhat.vscode-yaml
[14:38:14.337] Install and start server if needed
[14:38:14.339] PATH: /Users/zwing/Library/pnpm:/Users/zwing/.sdkman/candidates/java/current/bin:/Users/zwing/.config/yarn/global/node_modules/.bin:/Users/zwing/.pyenv/shims:/opt/homebrew/opt/gnu-sed/libexec/gnubin:/Users/zwing/.nvm/versions/node/v14.18.0/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/usr/local/go/bin:/Users/zwing/Library/Application Support/JetBrains/Toolbox/scripts:/Users/zwing/.ft:/Users/zwing/go/bin
[14:38:14.339] Checking ssh with "ssh -V"
[14:38:14.347] > OpenSSH_9.8p1, LibreSSL 3.3.6

[14:38:14.350] askpass server listening on /var/folders/kq/syf5l_d96z5dyq5ks2sdn2xh0000gn/T/vscode-ssh-askpass-7d29bce1be3382afc75e6b3f2e9886f1c9be4cba.sock
[14:38:14.350] Spawning local server with {"serverId":1,"ipcHandlePath":"/var/folders/kq/syf5l_d96z5dyq5ks2sdn2xh0000gn/T/vscode-ssh-askpass-847b5747b3dfee73a3e5280e35684acdf6fbfc79.sock","sshCommand":"ssh","sshArgs":["-v","-T","-D","49467","-o","ConnectTimeout=15","gz-GongfengIDE"],"serverDataFolderName":".vscode-server","dataFilePath":"/Users/zwing/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-125018c4-33fc5a94a3f99ebe7087e8fe79fbe1d37a251016-0.117.0-es/data.json"}
[14:38:14.350] Local server env: {"SSH_AUTH_SOCK":"/private/tmp/com.apple.launchd.VSF4PNzMeQ/Listeners","SHELL":"/bin/zsh","DISPLAY":"1","ELECTRON_RUN_AS_NODE":"1","SSH_ASKPASS":"/Users/zwing/.vscode/extensions/ms-vscode-remote.remote-ssh-0.117.0/out/local-server/askpass.sh","VSCODE_SSH_ASKPASS_NODE":"/Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin)","VSCODE_SSH_ASKPASS_EXTRA_ARGS":"","VSCODE_SSH_ASKPASS_MAIN":"/Users/zwing/.vscode/extensions/ms-vscode-remote.remote-ssh-0.117.0/out/askpass-main.js","VSCODE_SSH_ASKPASS_HANDLE":"/var/folders/kq/syf5l_d96z5dyq5ks2sdn2xh0000gn/T/vscode-ssh-askpass-7d29bce1be3382afc75e6b3f2e9886f1c9be4cba.sock"}
[14:38:14.351] Spawned 68842
[14:38:14.351] Using connect timeout of 17 seconds
[14:38:14.429] > local-server-1> Running ssh connection command: ssh -v -T -D 49467 -o ConnectTimeout=15 gz-GongfengIDE
[14:38:14.431] > local-server-1> Spawned ssh, pid=68855
[14:38:14.435] stderr> OpenSSH_9.8p1, LibreSSL 3.3.6
[14:38:14.491] stderr> debug1: Server host key: ssh-ed25519 SHA256:5WH8cQKHwFWpkYkoSboQ77LDB7fxo1Tq/swyO+d177w
[14:38:14.631] stderr> [email protected]: Permission denied (publickey).
[14:38:14.632] > local-server-1> ssh child died, shutting down
[14:38:14.635] Local server exit: 0
[14:38:14.635] Received install output: local-server-1> Running ssh connection command: ssh -v -T -D 49467 -o ConnectTimeout=15 gz-GongfengIDE
local-server-1> Spawned ssh, pid=68855
OpenSSH_9.8p1, LibreSSL 3.3.6
debug1: Server host key: ssh-ed25519 SHA256:5WH8cQKHwFWpkYkoSboQ77LDB7fxo1Tq/swyO+d177w
[email protected]: Permission denied (publickey).
local-server-1> ssh child died, shutting down

[14:38:14.635] WARN: $PLATFORM is undefined in installation script output.  Errors may be dropped.
[14:38:14.639] Resolver error: Error: Permission denied (publickey).
	at v.Create (/Users/zwing/.vscode/extensions/ms-vscode-remote.remote-ssh-0.117.0/out/extension.js:43933:20)
	at /Users/zwing/.vscode/extensions/ms-vscode-remote.remote-ssh-0.117.0/out/extension.js:43809:29
	at t.handleInstallOutput (/Users/zwing/.vscode/extensions/ms-vscode-remote.remote-ssh-0.117.0/out/extension.js:43837:17)
	at e (/Users/zwing/.vscode/extensions/ms-vscode-remote.remote-ssh-0.117.0/out/extension.js:44793:49)
	at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
	at async /Users/zwing/.vscode/extensions/ms-vscode-remote.remote-ssh-0.117.0/out/extension.js:45918:25
	at async t.withShowDetailsEvent (/Users/zwing/.vscode/extensions/ms-vscode-remote.remote-ssh-0.117.0/out/extension.js:46112:22)
	at async /Users/zwing/.vscode/extensions/ms-vscode-remote.remote-ssh-0.117.0/out/extension.js:44623:20
	at async T (/Users/zwing/.vscode/extensions/ms-vscode-remote.remote-ssh-0.117.0/out/extension.js:44517:17)
	at async t.resolveWithLocalServer (/Users/zwing/.vscode/extensions/ms-vscode-remote.remote-ssh-0.117.0/out/extension.js:44603:18)
	at async R (/Users/zwing/.vscode/extensions/ms-vscode-remote.remote-ssh-0.117.0/out/extension.js:45779:21)
	at async t.resolve (/Users/zwing/.vscode/extensions/ms-vscode-remote.remote-ssh-0.117.0/out/extension.js:45982:57)
	at async /Users/zwing/.vscode/extensions/ms-vscode-remote.remote-ssh-0.117.0/out/extension.js:60652:23
[14:38:14.643] ------




[14:38:14.644]  ---------- [Session Summary] ----------- 
[14:38:14.644] [PermissionDenied]: Error: PermissionDenied (Permission denied (publickey).)
[14:38:14.644]  ---------------------------------------- 

Expected Behavior

version 0.117
i want to connect to the host workspace7c8fc35xwrduptubl0@gz-GongfengIDE with hex encode ssh-remote+7b2275736572223a22776f726b7370616365376338666333357877726475707475626c30222c22776f726b73706163654964223a22776f726b7370616365376338666333357877726475707475626c30222c22686f73744e616d65223a22677a2d476f6e6766656e67494445222c22656e76223a2270726f227d

But it will lose the username, and connect to gz-GongfengIDE

Image

but in version 0.116, or set the remote.SSH.configFile to ~/.ssh/config. it work

0.116
Image

with configFile

Image Image

Actual Behavior

connect to the host

Steps To Reproduce

  1. update to the version 0.117
  2. clear the config remote.SSH.configFile
  3. connect to a host with username like someone@host

Anything else?

my config file

Host *gz.cloudide.woa.com gz-GongfengIDE
  HostName gz.cloudide.woa.com
  PubkeyAcceptedKeyTypes +ssh-rsa
  HostKeyAlgorithms +ssh-rsa
  HostKeyAlias gz-gongfeng-ide
  UserKnownHostsFile %d/.ssh/.gongfeng-ide/known_hosts
  IdentityFile %d/.ssh/id_ed25519_gongfeng_ide
@zWingz zWingz added the ssh Issue in vscode-remote SSH label Feb 7, 2025
@ArenaGrenade
Copy link

Hi!

I would like to add to this issue.

It seems that the SSH command that vscode executes just ignores any username input provided and setting the ssh config file doesn't really help everyone as @zWingz stated. My guess, @zWingz has the "User" field set inside their ssh config.

I can see the following line in the logs even when a username is provided.

Running ssh connection command: ssh -v -T -D 42957 -o ConnectTimeout=15 <target>

When the above command is executed without a specific username either in the ssh config or within the command, ssh defaults to the username of the host PC.

This is counterintuitive behavior to expect a single Target to be limited to a single user within the config or share username with the host PC which is an SSH default.

Seems to be a direct result of this set of changes. Kindly revert to 0.116.0 behavior.

@zWingz
Copy link
Author

zWingz commented Feb 7, 2025

@ArenaGrenade i have provided my config file

@joshspicer
Copy link
Member

joshspicer commented Feb 7, 2025

@zWingz Thanks for the detailed issue. Are you generating the hex-encoded JSON yourself? Upon my inspection it appears not to be generated by Remote - SSH as it has properties we would not serialize (or maybe haven't for quite some time).

May I understand why you cannot encode the user into the SSH config? That is the primary source of truth for SSH configuration. I see you are utilizing the configuration file already.

  1. clear the config remote.SSH.configFile

I suppose I want to better understand why you would perform this step in daily usage (and not provide the user in the configuration itself)? "Clearing" the config will also default to whatever your machine's ssh program considers the default, so I want to understand the significance of this step.

  1. connect to a host with username like someone@host

Is host here the host alias you shared above?

@joshspicer
Copy link
Member

@ArenaGrenade

Could you please share more detail (your SSH configuration and connection steps) where you feel this behavior is unintuitive? I presume <target> in your log snippet is a host in your SSH configuration?

@joshspicer
Copy link
Member

joshspicer commented Feb 7, 2025

A new pre-release build should be available shortly with a proposed fix.

In the change, the extension will always check for user in the hex authority string and forward that, even if there's a matching configuration entry or conflicting port information in that configuration. I believe this will bring the behavior back to what you folks expected.

Please give it a try and let me know if you have any feedback - thanks!

@joshspicer joshspicer added the bug Issue identified by VS Code Team member as probable bug label Feb 7, 2025
@braindevices
Copy link

braindevices commented Feb 8, 2025

this affect me too
I did not even use hex encoding, plain text worked before 0.117

code -n --file-uri vscode-remote://ssh-remote+usr@TestServer/tmp/test.code-workspace

@zWingz
Copy link
Author

zWingz commented Feb 10, 2025

A new pre-release build should be available shortly with a proposed fix.

In the change, the extension will always check for user in the hex authority string and forward that, even if there's a matching configuration entry or conflicting port information in that configuration. I believe this will bring the behavior back to what you folks expected.

Please give it a try and let me know if you have any feedback - thanks!

@joshspicer it work on pre-release, thanks

@joshspicer
Copy link
Member

@braindevices For my understanding, is there a reason why you don't put usr into your configuration file?

@braindevices
Copy link

@braindevices For my understanding, is there a reason why you don't put usr into your configuration file?

Simply because I need to access the same server with different user names when doing different tasks. For security reasons, sysop usually doesn't allow us to switch user after login.

@joshspicer
Copy link
Member

@braindevices @ArenaGrenade - does the pre-release work as you expect?

@joshspicer
Copy link
Member

Validated that @braindevices 's repro steps are fixed in the pre-release

Image

@joshspicer
Copy link
Member

Please comment if anything seems out of place in the pre-release still. This change will also be released when 0.117.1 stable is released.

@braindevices
Copy link

@braindevices @ArenaGrenade - does the pre-release work as you expect?

yes thanks!

@joshspicer joshspicer mentioned this issue Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug ssh Issue in vscode-remote SSH
Projects
None yet
Development

No branches or pull requests

4 participants