I am trying to use VSCode's extension remote-ssh from CLI to connect to a server through a ProxyJump.
For now, I am using an ssh config file that has the following structure:
Host myserver
ProxyJump user#jumpserver
User user
ForwardX11 true
ForwardX11Trusted yes
Hostname remoteserver
and from CLI I can open a folder on the server with:
code --folder-uri "vscode-remote://ssh-remote+myserver/path/to/folder"
Do you know if is possible to open such a folder without the need for a config file?
Related
I usually connect to remote computers through VS Code SSH. The settings (IP of the remote computer and public and private key pairs are properly set). The strange thing that is happening is that I can open any folder in the remote computer, but not the folder where the project is located (for example, I can also open the parent folder of the project).
It was working properly for years and now it has this type of problem.
Here, I report the output terminal:
[21:03:16.164] "remote.SSH.serverInstallPath": {}
[21:03:16.168] SSH Resolver called for host: PC000
[21:03:16.168] Setting up SSH remote "PC000"
[21:03:16.173] Using commit id "6261075646f044b98968d5000324gdhsdsjdd3b" and quality "stable" for server
[21:03:16.177] Install and start server if needed
[21:03:16.182] Checking ssh with "ssh -V"
[21:03:16.261] > OpenSSH_for_Wind
[21:03:16.262] > ows_8.1p1, LibreSSL 3.0.2
[21:03:16.273] Running script with connection command: ssh -T -D 64484 "PC000" bash
[21:03:16.275] Terminal shell path: C:\Windows\System32\cmd.exe
And after a while, it returns the timeout error.
I am putting the passphrase which it is requesting, then it is not able to connect to the folder.
Do anyone have some ideas?
I tried to open other folders with VS Code SSH connection and they are propery opened. I browsed with the command window to to the folder of the project and everything seem fine.
Did you try this option? "remote.SSH.useLocalServer": false, for more details, you can have a look the discussion here
Setting the terminal.integrated.inheritEnv option to true solved the problem
I was trying to connect my VSCode to remote machine using remote-ssh plugin. I added the host name, port and user in the .ssh config file. The problem I had was that there was no password prompt appeared hence I couldn't enter my password and the VSCode remote-ssh connection failed. I tested the connection using ssh in a terminal and it worked, which means there was no problem with the connection itself. Thanks!
Try to edit settings.json file. Add:
"remote.SSH.showLoginTerminal": true,
"remote.SSH.useLocalServer": false,
"remote.SSH.configFile": <path_to_ssh_config>
I have VSCode with the extension remote-ssh installed. I connect to a remote host by username and IdentityFile.
To access certain files on the remote host, I have to switch users using su <user>. But when I switch users, I can only access the file in the terminal and not in the file explorer and therefore I'm unable to use the graphical editor of VSCode to edit my files.
You can modify your config file like this:
Host remote
....
RemoteCommand su otherUser
according to https://github.com/microsoft/vscode-remote-release/issues/690#issuecomment-993857961
but remember to manually add
"remote.SSH.useLocalServer": true,
"remote.SSH.enableRemoteCommand": true,
to your VSCode settings.json file,
and remember to test the command su otherUser in ssh terminal and make sure it doesn't ask for a password (which will not work with RemoteCommand)
For me, I use RemoteCommand sudo su otherUser and disable sudo password for my ssh user.
Took me a while to search answers and configure, now it works perfectly.
If you have any other questions, go to the issue and read the thread.
I'm using vscode remote ssh heavily and each time, I have to start it regularly and and run the commmand to start a new instance with Remote SSH
Is there a way to use some arguments to VsCode shortcut to start directly in Remote SSH mode?
Thanks
Found this link that includes a section about connecting to a remote from terminal (or using a shortcut)
https://code.visualstudio.com/docs/remote/troubleshooting#_connect-to-a-remote-host-from-the-terminal
SSH remote needs to already have been manually setup (ssh config file and public/private key).
I'm exploring the new set extensions called VSCode Remote Pack and I want to connect to a Vagrant container using the Remote Container extension. Using a Windows 10 OS, how could I do that?
I tried the extension but it requests me to have Docker installed, what I suppose from that is that it only works for Docker containers. But I wonder if somebody have already managed to connect to a Vagrant box.
This are the docs from the extension: https://code.visualstudio.com/docs/remote/containers
VS Code Remote containers currently only support Docker (its implementation executes docker commands). Please open a feature request if you would like to see other tools supported.
As an alternative, you could try using Remote SSH to connect to vagrant containers. That should work but will require some extra container setup
Sorry for updating this so late.
The solution was pretty simple, as #MnZrk commented, what it needs to be done for setting up the connection is the following:
Run vagrant ssh-config > some-file.txt. This will generate a file with the configuration to run using SSH. Here an example of that file:
Host default
HostName 127.0.0.1
User vagrant
Port 2222
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile C:/Users/User/project/.vagrant/machines/default/virtualbox/private_key
IdentitiesOnly yes
LogLevel FATAL
ForwardAgent yes
ForwardX11 yes
Notice that the host name is default, you could rename it to whatever you want so you could identify it more easily.
Copy the content of some-file.txt inside your SSH configuration file. This file could be edit directly from vscode by pressing F1 and writing Remote-SSH: Open Configuration File..., then you select the file you use for ssh configuration. After that file opens, just copy the content of some-file.txt there.
Finally, just press again F1 and type Remote-SSH: Connect to Host..., choose the connection with the host name default or the want you wrote in the first step, and that's all.