-
Notifications
You must be signed in to change notification settings - Fork 257
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 Bug]: Invalid Character in hostname #9370
Comments
…mote -ssh interaction Currently, the suggested ssh config file configuration does not work, because it contains unescaped spaces. Unless a fix is deployed by the developers of the remote-ssh extension, hostnames with spaces make it unable to connect to the host, because an invalid character error is raised somewhere. See the following issue on the extension page: microsoft/vscode-remote-release#9370 I had the issue appear for me in the bootcamp yesterday and it took me a good 6 hours to find the fix. Assuming that it might take Microsoft a while to deploy a fix, I suggest changing the suggested naming for the host to not contain any spaces.
I'm having the same issue. this is my ssh config and error logs. ssh config
error logs[21:12:25.761] Looking for existing server data file at /home/fire/.config/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-2d599263-8b3775030ed1a69b13e4f4c628c612102e30a681-0.108.2023112915-tr/data.json [21:12:25.761] Using commit id "8b3775030ed1a69b13e4f4c628c612102e30a681" and quality "stable" for server [21:12:25.764] Install and start server if needed [21:12:25.766] PATH: /home/fire/.local/bin:/home/fire/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin [21:12:25.766] Checking ssh with "ssh -V" [21:12:25.774] > OpenSSH_8.9p1 Ubuntu-3ubuntu0.6, OpenSSL 3.0.2 15 Mar 2022 [21:12:25.777] Using SSH config file "/home/fire/.ssh/config" [21:12:25.777] askpass server listening on /run/user/1000/vscode-ssh-askpass-a76cac33e41ba7ec6f9bc9262c38d1625a0445f8.sock [21:12:25.778] Spawning local server with {"serverId":1,"ipcHandlePath":"/run/user/1000/vscode-ssh-askpass-6e247d4dc050739c76734f2e73329099315dc35d.sock","sshCommand":"ssh","sshArgs":["-v","-T","-D","43343","-o","ConnectTimeout=15","-F","/home/fire/.ssh/config","local(root)"],"serverDataFolderName":".vscode-server","dataFilePath":"/home/fire/.config/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-2d599263-8b3775030ed1a69b13e4f4c628c612102e30a681-0.108.2023112915-tr/data.json"} [21:12:25.778] Local server env: {"SSH_AUTH_SOCK":"/run/user/1000/keyring/ssh","SHELL":"/bin/bash","DISPLAY":":1","ELECTRON_RUN_AS_NODE":"1","SSH_ASKPASS":"/home/fire/.vscode/extensions/ms-vscode-remote.remote-ssh-0.108.2023112915/out/local-server/askpass.sh","VSCODE_SSH_ASKPASS_NODE":"/usr/share/code/code","VSCODE_SSH_ASKPASS_EXTRA_ARGS":"--ms-enable-electron-run-as-node","VSCODE_SSH_ASKPASS_MAIN":"/home/fire/.vscode/extensions/ms-vscode-remote.remote-ssh-0.108.2023112915/out/askpass-main.js","VSCODE_SSH_ASKPASS_HANDLE":"/run/user/1000/vscode-ssh-askpass-a76cac33e41ba7ec6f9bc9262c38d1625a0445f8.sock"} [21:12:25.782] Spawned 22381 [21:12:25.860] > local-server-1> Running ssh connection command: "-v -T -D 43343 -o ConnectTimeout=15 -F /home/fire/.ssh/config local(root)" [21:12:25.863] > local-server-1> Spawned ssh, pid=22390 [21:12:25.866] stderr> hostname contains invalid characters [21:12:25.867] > local-server-1> ssh child died, shutting down [21:12:25.872] Local server exit: 0 [21:12:25.872] Received install output: local-server-1> Running ssh connection command: "-v -T -D 43343 -o ConnectTimeout=15 -F /home/fire/.ssh/config local(root)" local-server-1> Spawned ssh, pid=22390 hostname contains invalid characters local-server-1> ssh child died, shutting down [21:12:25.873] Failed to parse remote port from server output [21:12:25.874] Resolver error: Error:
[21:12:25.878] ------ |
space character also does not work. my ssh/config:
vscode tries to connect to |
It might've been solved at that time but since 2024 I am experiencing issues again with it. So I hope it's solved soon! |
same issue here statring version 1.87.2, and mac os sonoma 14.4 The following does not work:
However once the dash replaces space, it now works:
|
@alexanderdevm No luck on my end replacing those spaces. This started occurring after I upgraded to Sonoma 14.4. I think it's becoming clear that this is a MacOS issue. None of my SSH configs using an IP as the HostName value work anymore. Only the one that uses a domain name instead. This is pretty major issue. Surprised it hasn't been mentioned more often. This doesn't work ^ (IP changed for privacy). This will work. Update: Changing the Host parameter to the IP address you're trying to connect to (from the label e.g. "Test Ubuntu") will make it work. Although that shouldn't be necessary because in the past it's always worked as intended. Update 2: Scratch all of that. I tested removing the space from the Host string and then restarted VS code this time. It works. So it's definitely the space causing issues. |
Encountered the same issue on Sonoma 14.4. Here's my SSH configuration:
Using Additionally, it seems that Remote-SSH is using the system's SSH command. This could be a MacOS issue rather than Visual Studio Code's? |
@amtoaer can you try changing the Host value to
Then restart your VS code and try to connect. I bet it works without the space. |
I was hit by this same problem, and I found that it's due to security fixes in OpenSSH 9.6. See the git commit with the changes for the specific characters that are not allowed in the hostname and username provided on the command line, but it includes spaces, parentheses, and most special characters. It looks like the only solution is to not use those characters for the Host in ssh config anymore. |
Hello, I'm also facing the same issue. I understand that the change mentioned above could be the root cause of this behavior. However, is that possible/feasible to add a check on this This will be the must. At this moment, I believe a lot of customers will spend some time trying and failing, and eventually, they will check the upstream, check for the issues, apply some queries, and at the end of the day, end up on this Issue. As we know, most of the customers will not find this issue :), they will try, fail and probably will stop, or maybe will just remove the extension, because they were not able to set a friendly label for the servers. Thank you for all your help and congrats on this amazing extension. |
I have this same error on Mac Sonoma 14.4.1, Remote-SSH v0.110.1. I've used the same ssh config for years and the issue started occurring for me a few weeks ago. Replacing the spaces in all of my hostnames with underscores resolved this for me. Would be great to have spaces back in hostnames though. |
I was able to successfully connect to a host name with a space
|
This is a change from the latest ssh version, I think you need 9.6 to verify this. macOS should have that, Windows will probably be behind unless you install it manually. |
Is there an existing issue for this bug?
Required Troubleshooting Steps
remote.SSH.useLocalServer
settingConnect Locally
It doesn’t connect successfully (same error message)
->
No response
Expected Behavior
I have several hosts in my config file and some of them contain spaces in their nicknames. The true hostnames are never containing spaces of course but the names I use can follow the same syntax like "ServerA v2.0" and because there is a space in the name I quote them for a long period of time without any issues. But this morning I cannot connect to these instances anymore unless I replace the space with anything
Steps To Reproduce
Host "ServerA v2.0"
HostName website.domain.com
User ubuntu
IdentityFile {myKey}
Remote-SSH Log
Crashing Remote-SSH Log
Working Remote-SSH Log
Anything else?
If anyone knows why this happens now, as it worked fine for I would say a year that would be great! Looking into the logs I can see why it happens with the command at
09:32:02.468
where the host name is not escaped (anymore) and I would love this functionality to return again :)Here are my OS facts:
Version: 1.85.1
Commit: 0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2
Date: 2023-12-13T09:47:11.635Z
Electron: 25.9.7
ElectronBuildId: 25551756
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Linux x64 5.15.0-91-generic snap
The text was updated successfully, but these errors were encountered: