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

Remote-SSH: Password prompted again when opening a folder #6227

Closed
aeschli opened this issue Jan 25, 2022 · 28 comments
Closed

Remote-SSH: Password prompted again when opening a folder #6227

aeschli opened this issue Jan 25, 2022 · 28 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug ssh Issue in vscode-remote SSH
Milestone

Comments

@aeschli
Copy link
Contributor

aeschli commented Jan 25, 2022

Testing #6220

Windows
Remote-WSL v0.71.2021121615 (pre-release)
Version: 1.64.0-insider (user setup)
Commit: f93c69659de1a1466bd15e0f1c9f790e73be9208
Date: 2022-01-25T08:42:41.055Z
OS: Windows_NT x64 10.0.19044

In #6220, step 3, it says that when I open a new folder, I shouldn't get prompted for a password again.

  • `Connect to Host... pick my host, enter password get the remote window
  • File > Open Folder, pick a folder, window is reopened, trust dialog shows, password input dialog shows

I know I could set up a SSH agent but I haven't done so.

@aeschli aeschli changed the title SSH: Password prompted again when opening a folder Remote-SSH: Password prompted again when opening a folder Jan 25, 2022
@tanhakabir
Copy link

@aeschli in your settings do you have remote.SSH.useLocalServer: true? We have this issue on Windows for appropriately setting useLocalServer: #6147 (comment)

@tanhakabir tanhakabir added the ssh Issue in vscode-remote SSH label Jan 25, 2022
@aeschli
Copy link
Contributor Author

aeschli commented Jan 25, 2022

The Remote-SSH version is now v0.71.2022012519

The settings UI shows this:
image
so I assume it is set.

I now explicitly put "remote.SSH.useLocalServer": true, but no change. After open Folder I still have to login again.

@tanhakabir
Copy link

Would you be able to share your logs for the reloaded window with the folder?

@tanhakabir tanhakabir added the info-needed Issue requires more information from poster label Jan 25, 2022
@aeschli
Copy link
Contributor Author

aeschli commented Jan 25, 2022

[23:38:22.096] Log Level: 2
[23:38:22.097] [email protected]
[23:38:22.097] win32 x64
[23:38:22.135] SSH Resolver called for "ssh-remote+7b22686f73744e616d65223a224d617274696e2d5043227d", attempt 1
[23:38:22.135] "remote.SSH.useLocalServer": true
[23:38:22.136] "remote.SSH.path": undefined
[23:38:22.136] "remote.SSH.configFile": undefined
[23:38:22.136] "remote.SSH.useFlock": true
[23:38:22.136] "remote.SSH.lockfilesInTmp": false
[23:38:22.136] "remote.SSH.localServerDownload": auto
[23:38:22.137] "remote.SSH.remoteServerListenOnSocket": false
[23:38:22.137] "remote.SSH.showLoginTerminal": false
[23:38:22.137] "remote.SSH.defaultExtensions": []
[23:38:22.137] "remote.SSH.loglevel": 2
[23:38:22.137] "remote.SSH.enableDynamicForwarding": true
[23:38:22.137] "remote.SSH.enableRemoteCommand": false
[23:38:22.138] "remote.SSH.serverPickPortsFromRange": {}
[23:38:22.138] "remote.SSH.serverInstallPath": {}
[23:38:22.138] SSH Resolver called for host: Martin-PC
[23:38:22.138] Setting up SSH remote "Martin-PC"
[23:38:22.141] Acquiring local install lock: C:\Users\martinae\AppData\Local\Temp\vscode-remote-ssh-ba5406f0-install.lock
[23:38:22.143] Looking for existing server data file at c:\Users\martinae\AppData\Roaming\Code - Insiders\User\globalStorage\ms-vscode-remote.remote-ssh\vscode-ssh-host-ba5406f0-f93c69659de1a1466bd15e0f1c9f790e73be9208-0.71.2022012519\data.json
[23:38:22.144] Using commit id "f93c69659de1a1466bd15e0f1c9f790e73be9208" and quality "insider" for server
[23:38:22.149] Install and start server if needed
[23:38:22.154] Checking ssh with "ssh -V"
[23:38:22.193] > OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2

[23:38:22.196] Checking ssh with "C:\WINDOWS\System32\OpenSSH\ssh.exe -V"
[23:38:22.234] > OpenSSH_for_Windows_8.1p1, L
[23:38:22.234] > ibreSSL 3.0.2

[23:38:22.236] Checking ssh with "C:\Program Files\Git\usr\bin\ssh.exe -V"
[23:38:22.271] > OpenSSH_8.4p1, OpenSSL 1.1.1j  16 Feb 2021

[23:38:22.275] Using SSH config file "C:\Users\martinae\.ssh\config"
[23:38:22.275] askpass server listening on \\.\pipe\vscode-ssh-askpass-dce4f037a5c138ddf4bd9be7a219e226517d2cab-sock
[23:38:22.276] Spawning local server with {"serverId":1,"ipcHandlePath":"\\\\.\\pipe\\vscode-ssh-askpass-b8465eb2b4de8d39b539ba258d4eb84b8d6a43b4-sock","sshCommand":"C:\\Program Files\\Git\\usr\\bin\\ssh.exe","sshArgs":["-v","-T","-D","50961","-F","C:\\Users\\martinae\\.ssh\\config","Martin-PC"],"serverDataFolderName":".vscode-server-insiders","dataFilePath":"c:\\Users\\martinae\\AppData\\Roaming\\Code - Insiders\\User\\globalStorage\\ms-vscode-remote.remote-ssh\\vscode-ssh-host-ba5406f0-f93c69659de1a1466bd15e0f1c9f790e73be9208-0.71.2022012519\\data.json"}
[23:38:22.276] Local server env: {"DISPLAY":"1","ELECTRON_RUN_AS_NODE":"1","SSH_ASKPASS":"c:\\Users\\martinae\\.vscode-insiders\\extensions\\ms-vscode-remote.remote-ssh-0.71.2022012519\\out\\local-server\\askpass.bat","VSCODE_SSH_ASKPASS_NODE":"C:\\Users\\martinae\\AppData\\Local\\Programs\\Microsoft VS Code Insiders\\Code - Insiders.exe","VSCODE_SSH_ASKPASS_EXTRA_ARGS":"--ms-enable-electron-run-as-node","VSCODE_SSH_ASKPASS_MAIN":"c:\\Users\\martinae\\.vscode-insiders\\extensions\\ms-vscode-remote.remote-ssh-0.71.2022012519\\out\\askpass-main.js","VSCODE_SSH_ASKPASS_HANDLE":"\\\\.\\pipe\\vscode-ssh-askpass-dce4f037a5c138ddf4bd9be7a219e226517d2cab-sock"}
[23:38:22.285] Spawned 29160
[23:38:22.365] > local-server-1> Spawned ssh, pid=13880
[23:38:22.398] stderr> OpenSSH_8.4p1, OpenSSL 1.1.1j  16 Feb 2021
[23:38:22.436] stderr> debug1: Server host key: ecdsa-sha2-nistp256 SHA256:czu/vEm86e/6TlufN4UDAcO2/0ihZ3CIIUPPYMJwtiA
[23:38:22.564] Got askpass request: {"request":"[email protected]'s password: "}
[23:38:22.565] Showing password prompt
[23:38:22.566] Listening for interwindow password on \\.\pipe\vscode-ssh-askpass-34b17ac28ca2c8d828196fd49544345b5738557e-sock
[23:38:22.566] Writing password prompt to globalState

@tanhakabir tanhakabir added bug Issue identified by VS Code Team member as probable bug and removed info-needed Issue requires more information from poster labels Jan 25, 2022
@sbatten
Copy link
Member

sbatten commented Jan 26, 2022

with today's build i see the same (this is the only bug i hit in the flow now, aside from the pwsh issue)

@Xiao-Chenguang
Copy link

same issue on my win10 laptop. However vscode on my mac only need password and otp once. Both devices share the ssh setting.

@tanhakabir tanhakabir assigned roblourens and unassigned tanhakabir Sep 2, 2022
@jsboer
Copy link

jsboer commented Oct 28, 2022

I meet same problem in my win11, but not in linux deepin.

@matija2209
Copy link

I have the same problem on MacOs

@roblourens
Copy link
Member

This looks like a real bug in useLocalServer not working correctly. It seems like the local server is getting killed (probably by vscode) whenever the window reloads. I will ask around to see whether anybody knows about this, but we should try old builds to see if we can figure out which vscode version this broke in. At this point I really think it's a vscode issue, not Remote-SSH.

@roblourens
Copy link
Member

Actually, it seems that I do the wrong thing for communicating with the local server. Discussion: https://vscodeteam.slack.com/archives/C03ERNTC03X/p1670890778629489

We spawn the local server here and communicate over stdio: https://github.com/microsoft/vscode-remote-ssh/blob/0257ea91b18c4c7c58bb1bcb1c40d4d58c76fe89/open-ssh-remote/src/local-server.ts#L305

But the docs clearly say that when spawning a detached process that will outlive its parent, you have to use stdio: 'ignore': https://nodejs.org/api/child_process.html#optionsdetached

This used to work as long as you didn't write to stdio when the parent was dead. This behavior probably changed with an electron update at some point.

So now, we have to communicate with the local server over an ipc channel instead of stdio. Fortunately, we already have a tcp server set up for communication with the local server, so this should be relatively easy. An alternative is Deepak's suggestion in Slack.

@YoniChechik
Copy link

I want to add to this a similar bug (maybe the same reason?): after you open a new folder (and entering the password again), if you have a .code-workspace file you will be prompted to enter to your workspace, and when you do- you'll have to enter the password yet again!

@eleanorjboyd eleanorjboyd modified the milestones: March 2023, April 2023 Mar 20, 2023
@eleanorjboyd
Copy link
Member

@u84six can you open another issue if you are noticing a recent regression? Thanks

@eleanorjboyd
Copy link
Member

@YoniChechik, how many times are you being prompted? if it is more than 2 or 3 please open another issue and we can continue the conversation there. Thanks!

@u84six
Copy link

u84six commented Mar 22, 2023

@u84six can you open another issue if you are noticing a recent regression? Thanks

The reason I didn't open a new ticket is because this one already exists... and it's still open

@eleanorjboyd
Copy link
Member

@u84six this is an issue that has been known for over a year, has your regression come up more recently or does this align with the timeline you noticed this problem at? Not sure if it has worked for you in the past or if you are just recently using this extension.

@YoniChechik
Copy link

@eleanorjboyd my setup is as follows:

I use docker on a remote linux machine (connecting from a personal windows pc).

  1. open vscode on my pc.
  2. use remote-ssh extension to log in to remote linux - password prompt # 1
  3. go to remote-dev-conteiner extension (another open bug [Remote-SSH Bug]: Refresh to provide SSH credentials when SSHing to remote pc and try to open docker conteiners drop-down their #8242) - password prompt # 2
  4. attach to running container- new vscode window opened- password prompt # 3
  5. open workspace inside docker- password prompt # 4 (this is the current open bug- Remote-SSH: Password prompted again when opening a folder #6227 )
  6. Done.

@u84six
Copy link

u84six commented Mar 23, 2023

@eleanorjboyd my setup is as follows:

I use docker on a remote linux machine (connecting from a personal windows pc).

  1. open vscode on my pc.
  2. use remote-ssh extension to log in to remote linux - password prompt # 1
  3. go to remote-dev-conteiner extension (another open bug [Remote-SSH Bug]: Refresh to provide SSH credentials when SSHing to remote pc and try to open docker conteiners drop-down their #8242) - password prompt # 2
  4. attach to running container- new vscode window opened- password prompt # 3
  5. open workspace inside docker- password prompt # 4 (this is the current open bug- Remote-SSH: Password prompted again when opening a folder #6227 )
  6. Done.

Thank you for saving me the time! :)

@u84six
Copy link

u84six commented Mar 23, 2023

@u84six this is an issue that has been known for over a year, has your regression come up more recently or does this align with the timeline you noticed this problem at? Not sure if it has worked for you in the past or if you are just recently using this extension.

Well the last time I used these extensions was quite a while ago on a different machine, when the extensions were in the "experimental" stage. I just recently installed the extensions again (after years) and I'm seeing this issue. Whenever I open a new folder after logging in, I get prompted for my password. Can you reproduce this on your end? If not, I'd be really surprised because it seems consistent. The remote machine I ssh to is CentOS v7

@eleanorjboyd
Copy link
Member

Hi! Yes that behavior is the current bug we are attempting to fix and will hopefully be resolving soon. Thanks

@YoniChechik
Copy link

Hi @eleanorjboyd.
Saw this bug deferred twice and now it doesn't appear in June sprint. Any plans to solve this soon?

@okunamayanad
Copy link

I can confirm that this bug is still a thing to this day.

@philmade
Copy link

philmade commented Dec 6, 2023

I have this problem but wonder if its because when I setup the SSH key I made it a password protected identity file. Would that make it ask for SSH Password every single time?

@matthost
Copy link

matthost commented Jan 2, 2024

This isn't necessarily Windows specific. On MacOS and connecting to a Linux machine I have been seeing this for over a year.

Edit: Adding IdentityFile to ssh config actually did not fix

Edit again: ssh-agent did work, thanks for that

@Xiao-Chenguang
Copy link

As this issue has been post for more than two years and not resolved yet, I'd like to share a workaround I found works in MacOs and Window, otherwise we have to roll back to later 2021 version vscode to enjoy one password experience.

The workaround is to turn on both "remote.SSH.useExecServer" and "remote.SSH.useLocalServer".

In case the vscode GUI setting not work properly, add two line to your user setting.json file.

"remote.SSH.useExecServer": true,
"remote.SSH.useLocalServer": true,

If your are using a windows pc, you have to do one more thing, that is use ssh shipped with git. The builtin Openssh in window does not work perfect along vscode.
You can install git and find the path of ssh executable in git install folder like C:Program file\git\...\ssh.exe.
Then you need to set the Remote.SSH: Path to this new ssh.exe.
And you have to set the ssh config file manually in unix style like 'C:/user/usrname/.ssh/config', other your may encounter error not found config file.

And lastly, there is a known limitation of useExecServer when you want to use proxyjump with portforward. I recommend you writ the port forward in the config to workaround this.

@roblourens
Copy link
Member

It looks like this no longer reproes with useExecServer=true, and that should be the default now for all users, so I'm going to close this.

@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Aug 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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