Howto connect eclipse RSE to google-compute-engine - eclipse

I can't get my Eclipse 3.8 (Ubuntu installation), RSE/TM plugin 3.4 or 3.5 connect with google-compute-engine/debian-7-wheezy-v20140606. I have tried to use vm IP directly and also alias method that gcloud compute command line utility provides. Both work from command line but RSE ends up authentication error. It seems that RSE ignores ~/.ssh/config that alias method uses.
Do anyone know what settings/procedure should I use for this connection?

I found how to make settings.
Supposing that your connection name is GCE-1:
Open Remote System Explorer perspective.
Select GCE-1 from Remote System Explorer window.
Right click -> Properties.
Select Host at the left panel of "Properties for GCE-1" window.
Click Configure proxy settings at the Host panel of "Properties for GCE-1" window.
Navigate General -> Network Connection -> SSH2.
Select General tab.
Click Add Private Key button.
Navigate to ~/.ssh.
Select google_compute_engine and click OK and OK.
Note that GCE command line tools create this file by default.
Done! Now you can navigate e.g. your Sftp Files below GCE-1 Within Remote Systems window.

Related

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.

No "open folder in container" or any other command in remote-containers vs code

I'm using a remote machine, and want to run a docker inside that machine (local->remote->docker) and wish to use the Remote development in Containers tools of vs code
Unfortunatlly, I do not see any of the actions after installing the extension.
My view (ctrl+shift+p -> type remote-containers)
While the tutorial has actions I don't even see:
You need to make sure you are not connected to your remote host via Remote-SSH in VSCode. If you are, you will not see "Open Folder in Container..." or the other options.
Try opening up VSCode without connecting using Remote-SSH. You will find that the option is now present.
To set up a remote Docker host, you first need to be able to access your remote host using key based authentication as describe here
You then set
"docker.host":"ssh://your-remote-user#your-remote-machine-fqdn-or-ip-here"
in setting.json.
Once that is setup, you can only attach to running containers. Test this out before proceeding:
Start a container on the remote host
Hit F1 in your vscode and then select "Attach to Running Container..."
You should see the container you started and you should be able to attach to this
Once you are past this point, you will need to create your devcontainer.json file as per the documentation
Make sure you have installed Remote Container extension.
and ssh as mentioned on the comment above.
Once installed, click on Docker icon, under containers, right click on the container you need to work with vcode and select attach vscode.
I had this issue when I opened vscode for the first time in a year after only needing to install it for some random project that wanted me to use "dev containers" for, I don't remember what.
But I don't care about dev containers anymore and I don't remember that project, however, vscode was functionally unusable because it opened in that old project directory and was trying to do... something with containers. I don't know, I don't care, I just wanted to open another folder so a junior programmer could use an IDE on my machine they're familiar with instead of emacs/vim/whatever.
The solution for me was to use the "extensions" tab CTRL+SHIFT+X, disable the "Dev Containers" extension, then use "File -> Open Recent Folder" to select some other directory. This gets around the "can't open in container" bug. If you don't have a history of other opened directories, I think you need to completely reinstall Vscode or something.

SFTP connection from Eclipse to Google Cloud Instance

I am struggling to connect my Eclipse Remote environment to my Google cloud Instance.
I have generated a public and private key with ssh-keygen on my mac and stored them in the ~/.ssh folder. I copied the public key to the google cloud using the metadata and added the key to the ssh keys listed. I also added the private key to eclipse in the SSH2 settings. Trying to connect give me error: Failed to connect sshd on " my ip-address".
The strange thing is that Filezilla can connect in this way, but `i would like the comfort from Eclipse. Can somebody help me with this problem??
If you were able to access by sftp with Filezilla that means that your ssh-keys are correct, I recommend you put the ssh-key in the metadata section of the instance, here is the link with the steps.
To connect with eclipse:
Try the Remote System Explorer (RSE). It's a set of plug-ins to do exactly what you are looking for.
RSE may already be included in your current Eclipse installation. To check in Eclipse Indigo go to Window > Open Perspective > Other... and choose Remote System Explorer from the Open Perspective dialog to open the RSE perspective.
To create an SSH remote project from the RSE perspective in Eclipse:
Define a new connection and choose SSH Only from the Select Remote
System Type screen in the New Connection dialog.
Enter the connection information then choose Finish.
Connect to the new host. (Assumes SSH keys are already set up.)
Once connected, drill down into the host's Sftp Files, choose a
folder and select Create Remote Project from the item's context
menu. (Wait as the remote project is created.)
If done correctly, there should now be a new remote project accessible from the Project Explorer and other perspectives within eclipse. With the SSH connection set-up correctly passwords can be made an optional part of the normal SSH authentication process. A remote project with Eclipse via SSH is now created.

Is there an Eclipse plugin that can replace the use of external tools such as Putty and WinScp

Every time I want to run my project on the remote server, I need to export it from Eclipse as a jar file, to transfer the file from my local machine to the remote server using WinSCP and then to use Putty to run it on the remote server. I am wondering is there a more suitable way of handling this, e.g. an Eclipse plugin that allows me to perform this straight from Eclipse.
This functionality is present in Eclipse, called Remote Systems Explorer.
Open the Remote Systems view by going to Window -> Show View -> Other....
Then right click in this view and select on New connection....
Select SSH Only as remote system type and click Next.
Fill in the necessary information such as hostname and connection name and click Finish.
Select the Connector node you just created from the Remote Systems view and choose Connect.... Enter your credentials and press Ok.
If you managed to log in, you will see a green arrow on the node indicating you are connected.
You can right click either Shells or Terminals and choose Launch Shell/Terminal. A new Remote Shell or Terminal should appear where you can type in commands.
It is also possible to remotely create files, open/edit and save them from within Eclipse.
More documentation can be found in the Eclipse RSE manual.

Are there any good ssh consoles for Eclipse?

I'm looking for a good ssh console plugin for Eclipse, and can't find much at all. Would anyone have some good leads on one?
If you don't like the ssh.shells or ssh.terminals subsystems in Eclipse RSE, try using the Terminal View instead.
Open up Window -> Show View -> Other (or press Shift+Alt+Q then Q)
Type Terminal in the search box
Select the Terminal view listed under the Terminal folder
You'll see a window that looks similar to RSE's ssh.terminals subsystem... but with some extra buttons on the top right.
How to use it:
To fix the scrolling issue (ie: for programs like top), click the Scroll Lock button at the right.
For extra Terminal window tabs, click the down arrow on the New Terminal Connection button
To change the current terminal window's settings, use the Settings button.
If you really like the annoying command input box at the bottom, you can toggle it on and off with the appropriate button.
Change the Background Color:
For some reason, the default setting is to use a terribly hard to see white background. To change this:
Go to Window -> Preferences
Type Terminal in the search box at the top left, or select Terminal on the left.
Check the box that says Invert terminal colors
You can also configure a larger terminal buffer or connection timeouts here
Click Apply
Now the terminal should have a black background! If you want a local terminal, you can enable ssh on your local machine, and connect to localhost.
In Eclipse 3.4.1, there is the Remote Systems Explorer perspective that allows you to create and connect to SSH terminals (here)
There are plugins that exist that allow you up open WinSCP or Putty from within Eclipse.
I would advise maybe doing a search for "putty eclipse plugin" or similar
You can also try the Terminal plug-in for Eclipse
This plug-in provides a fully-working, command-line terminal to
Eclipse 3.7 or later (yes, even 4.2!) It works on Linux and MacOS
only.
More info at: http://alexruiz.developerblogs.com/?p=2428