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

Attach VS Code link using windows username for login attempt #228

Open
yfhyou opened this issue Sep 19, 2023 · 3 comments
Open

Attach VS Code link using windows username for login attempt #228

yfhyou opened this issue Sep 19, 2023 · 3 comments

Comments

@yfhyou
Copy link

yfhyou commented Sep 19, 2023

Hello - I'm using the tailscale integration with VSCode for Windows 10. I have done the right click and set Change SSH Username to ubuntu. After doing this, clicking on the Terminal shortcut next to the machine name properly sends the ssh ubuntu@my-machine.mytailnet.ts.net command and connects without issue.

However, clicking the Attach VS Code shortcut will still send my current windows username in the ssh command. Log below:

Log
[10:22:43.561] "remote.SSH.useLocalServer": false
[10:22:43.561] "remote.SSH.useExecServer": false
[10:22:43.562] "remote.SSH.showLoginTerminal": false
[10:22:43.562] "remote.SSH.remotePlatform": {}
[10:22:43.562] "remote.SSH.path": undefined
[10:22:43.562] "remote.SSH.configFile": undefined
[10:22:43.563] "remote.SSH.useFlock": false
[10:22:43.563] "remote.SSH.lockfilesInTmp": false
[10:22:43.563] "remote.SSH.localServerDownload": auto
[10:22:43.563] "remote.SSH.remoteServerListenOnSocket": false
[10:22:43.563] "remote.SSH.showLoginTerminal": false
[10:22:43.564] "remote.SSH.defaultExtensions": []
[10:22:43.564] "remote.SSH.loglevel": 2
[10:22:43.564] "remote.SSH.enableDynamicForwarding": true
[10:22:43.565] "remote.SSH.enableRemoteCommand": false
[10:22:43.565] "remote.SSH.serverPickPortsFromRange": {}
[10:22:43.565] "remote.SSH.serverInstallPath": {}
[10:22:43.571] VS Code version: 1.82.2
[10:22:43.571] Remote-SSH version: remote-ssh@0.106.4
[10:22:43.571] win32 x64
[10:22:43.578] SSH Resolver called for host: my-machine.mytailnet.ts.net
[10:22:43.578] Setting up SSH remote "my-machine.mytailnet.ts.net"
[10:22:43.583] Using commit id "abd2f3db4bdb28f9e95536dfa84d8479f1eb312d" and quality "stable" for server
[10:22:43.586] Install and start server if needed
[10:22:47.414] Checking ssh with "C:\Windows\system32\ssh.exe -V"
[10:22:47.418] Got error from ssh: spawn C:\Windows\system32\ssh.exe ENOENT
[10:22:47.418] Checking ssh with "C:\Windows\ssh.exe -V"
[10:22:47.419] Got error from ssh: spawn C:\Windows\ssh.exe ENOENT
[10:22:47.419] Checking ssh with "C:\Windows\System32\Wbem\ssh.exe -V"
[10:22:47.420] Got error from ssh: spawn C:\Windows\System32\Wbem\ssh.exe ENOENT
[10:22:47.420] Checking ssh with "C:\Windows\System32\WindowsPowerShell\v1.0\ssh.exe -V"
[10:22:47.421] Got error from ssh: spawn C:\Windows\System32\WindowsPowerShell\v1.0\ssh.exe ENOENT
[10:22:47.421] Checking ssh with "C:\Windows\System32\OpenSSH\ssh.exe -V"
[10:22:47.451] > OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2

[10:22:47.454] Running script with connection command: "C:\Windows\System32\OpenSSH\ssh.exe" -T -D 58493 "my-machine.mytailnet.ts.net" bash
[10:22:47.456] Terminal shell path: C:\Windows\System32\cmd.exe
[10:22:47.668] > �]0;C:\Windows\System32\cmd.exe�
[10:22:47.669] Got some output, clearing connection timeout
[10:22:47.925] > WINDOWSUSER@my-machine.mytailnet.ts.net: Permission denied (tailscale).
[10:22:47.940] > The process tried to write to a nonexistent pipe.
[10:22:49.189] "install" terminal command done
[10:22:49.190] Install terminal quit with output: �]0;C:\Windows\System32\cmd.exe�WINDOWSUSER@my-machine.mytailnet.ts.net: Permission denied (tailscale).
[10:22:49.190] Received install output: �]0;C:\Windows\System32\cmd.exe�WINDOWSUSER@my-machine.mytailnet.ts.net: Permission denied (tailscale).
[10:22:49.193] Resolver error: Error: Permission denied (tailscale).
@tylersmalley
Copy link
Contributor

tylersmalley commented Sep 19, 2023

I am trying to think of a better solution here. From what I have been able to tell, VS Code does not support providing the username with this API. Instead, they require setting the username in the SSH config. We have documented this here.

We could provide an error message if the username has been set in the extension, but it has not been in the SSH config - but that would require us reading the SSH config file, which I am not sure is something we want to do.

@yfhyou
Copy link
Author

yfhyou commented Sep 19, 2023

That is an unfortunate limitation.
Sorry I missed that in the documentation. Doing that fixed the issue. Just a bit tedious to manage when using multiple computers or adding removing machines often.

Is it possible to just prompt for a username on first connect?

@NewtonChutney
Copy link

Just stumbled across the same problem.. 🫠
@tylersmalley did you get any response from the VSCode team? This is an actual use case.. to have an on demand vscode connection without saving in ssh config..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants