VS code Remote Development problem with SSH connection (Windows to Linux) - visual-studio-code

I'm Currently trying to setup Remote developement environment with VS code.
I have installed Remote - SSH plugin and edited my .ssh/config file as below
Host ABC
User ubuntu
HostName xx.xx.xx.xx
IdentityFile ~/.ssh/filename
It trowing an error by saying "An SSH Installation couldn't be found"
Local Machine - Windows
Host Machine - Ubuntu(Linux)
Please help on this matter

You are missing an SSH tool in your host machine. Popular implementation of SSH protocol, OpenSSH is installed by default in Windows 10. First confirm if you have OpenSSH client by going to
Windows Settings >> Apps & features >> Optional Features
If not, install OpenSSH client through "Add a feature" option at the optional features page.
Mostly VSCode can pick the executable from common installation locations of the ssh.exe. If still not able to resolve, add the property below in VSCode settings
"remote.SSH.path": "your/ssh.exe/path"
like
"remote.SSH.path": "C:\Windows\System32\OpenSSH"

I have Windows 10 - 1608 version and it doesen't exist OpenSSH Feature in >> Optional Features.
I had downlosded OpenSSH seporately and now it's working as expected.
and another mistake I have done. I have tried to connect with .ppk key as the IdentityFile. And I have converted to private key using puttyGen. It is working perfectly now

Thanks for the help guys. Openssh was not present so had to install OpenSSH from Windows Powershell
https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse
Then copied the path of ssh.exe to VScode settings. Ex:
"remote.SSH.path": "C:\Program Files\OpenSSH-Win64\ssh.exe"
It worked perfectly.

Instead of installing OpenSSH, installing Git on Windows 7 also works because Git for Windows installs the SSH client. It ships OpenSSH with the package.

Related

Why are VSCode extensions not working in SSH

I am using the Remote-SSH extension. When I SSH to a local VM that has Linux, or far away to my uni's pc lab, all my VSCode local extensions don't work, it doesn't show under the extensions pane -> local installed. So doing the keyboard shortcut for one says "command 'extension.advancedNewFile' not found". Why is this and how do I fix this?
The first diagram in https://code.visualstudio.com/docs/remote/ssh shows it clearly that only theme/UI extensions remain applicable when VSCode is under remote development mode,
If you want features of certain extensions, you have to install them on the remote machine (under EXTENSIONS | SSH: MACHINE_NAME - INSTALLED).

Remote debug of Rust program in Visual Studio Code where VSCode sits on Windows

dear Craig McQueen!
I am referring to: Remote debug of Rust program in Visual Studio Code
My config is slightly different that is why I cannot get everything going here:
VScode installed on WIN32 with RUST components successfully!
remote system: odroid C2 ARM64 with UBUNTU18.04 with Kernel 5.14nwith IP: 192.xxx.6.x - user odroid.
I need to remote-compile a Rust program called: c2_mmap_gpio on the OdroidC2
This is already a project on the WIN32.
I did all the steps but it doesn't work.
I think it is not possible to try to run a remote_debug.sh (bash) on a windows machine, right? If yes workaround on this?
I think I need to input my user PWD somewhere to be able to ssh into the remote linux machine, right?
Correct, the remote_debug.sh I described in my answer is good only for a Linux system, and not suitable for a Windows system. For a Windows development system, you would need to write a Windows batch file or Powershell script that provides the equivalent functionality to that remote_debug.sh Bash script.
I'm not proficient in Powershell scripts, and I'm happy using Linux
as my host development machine, so I don't have plans to write such a script.
Regarding needing to enter a password for the SSH operations... Good point. That's something I didn't think to mention in my answer. You need to remove the need for a password to be entered, in one of two ways:
Install your public SSH credentials onto the target, using ssh-copy-id (or the Windows equivalent). Then you should be able to SSH to the target without needing to enter your password.
Give a blank password to the target user on the target, using passwd -d <username>. Note this reduces security, so this is not recommended, especially if the target is accessible via the public Internet.

OpenSSH not working on windows server 2016

I have managed to install the OpenSSH on my windows server and am able to ssh from my computer. But I am facing some weird issues after ssh into the server. When I try to move around like running cd it works but when I try to create a file and etc it prompted me that the command is invalid.
I have used this tutorial to set up the OpenSSH on my windows server.
Is powershell installed on your server?
Looks like powershell is not installed.
What I see now, you are connected with regular cmd, not with powershell.
Try to start Powershell first

Is it possible to open VSCode from Windows terminal while SSH'ed into a virtual machine?

I'm working on some tutorials and trying to do something, but no idea if it can be done. I am using windows terminal in Windows 10. I have an Ubuntu virtual machine running.
I'd like to:
Open Windows terminal
SSH into the Linux Virtual Machine
Type in the code . command and have it open a version of VS Code on my Windows PC that is working on the folder in the Ubuntu VM.
I tried install code locally and on the command line in the other machine, but it doesn't work. I am sure there are other ways to do this but wanted to explain how I was doing it to show I at least tried something. Thanks for your help.
It's not quite as easy as the code . technique you get with the Remote - WSL extension, but Microsoft also provides a Remote - SSH extension that can be used to directly access the remote machine (without requiring WSL in-the-middle).
Once the Remote - SSH extension is installed in VSCode (and it may have already been installed in an extension pack with the WSL extension), and you have installed an OpenSSH client in Windows, there are several ways to access files on the remote host through SSH:
From the Command Palette (Ctrl+Shift+P), type Remote SSH to filter on those commands. From Connect to Host, you can add a new configuration, etc.
From the Activity Bar on the left, select the Remote Explorer icon, then in the dropdown at the top, select SSH Targets. You can add hosts here through the + icon.
There's a direct shortcut to Open a Remote Window at the far left of the status bar. This will give you similar filter options on the Command Palette as above.
Once a host is configured, you can browse it just as (well, almost) if it were local, open files, edit, etc. The one thing you can't do (as far as I'm aware) is any type of sudo/su editing on files that you don't have permissions to directly.
Full details in the VSCode docs here.

Netbeans can't add remote host running on Virtualbox

I installed Ubuntu Server 15 on VirtualBox 5.0.10 and set up ssh access to the guest using NAT/port forwarding (host:3022->guest:22). The host is Windows 7 64bit.
I can successfully access the Ubuntu server via putty or other ssh client from an external computer (not the host). But NetBeans 8.0.2 can't complete adding the remote host. It just freezes on "Connecting ip_addr:3022..." stage (authentication type is 'Password')
What can be the reason? How can I resolve it?
It seems like the reason is that com-jcraft-jsch.jar distributed with NetBeans 8.0.2 doesn't work with OpenSSH 6.9 distributed with Ubuntu 15. There is a workaround for this, but unfortunately it doesn't work with OpenSSH 6.9.
I was able to resolve the issue after I downloaded and built OpenSSH-5.4 (requires zlib-dev, libssl-dev and some other packages). To use existant ssh config files you need to configure OpenSSH properly before build:
./configure --sysconfdir=/etc/ssh
make
sudo make install
Please note that make install will install binaries in /usr/local/bin, configuration files in /usr/local/etc, the server in /usr/local/sbin, etc. To specify a different installation prefix, use the --prefix option to configure.
You may need to modify /etc/ssh/sshd_config file (at least to point to sftp-server) and you may want to modify /etc/init.d/ssh, but anyway, OpenSSH-5.4 does work with NetBeans 8.0.2.
UPD: NetBeans 8.0.2 also works correctly with OpenSSH 6.6.1