7

I know you can set up remote connection in Netbeans or as others have suggested, mount the remote file system locally and let Netbeans read that.

This current set-up I have to SSH into a remote server and then SSH again into another one.

Is it possible in Netbeans to access the filesystem on the 2nd server hop?

3 Answers 3

2
+50

I think you can setup a SSH local port forwarding on your first remote server to archive what you want here. Once ssh connection established with the first server, it will be tunnel to second server. Also, will be much more convenient if using SSH public key as authentication method.

Run below command on your local (Need to keep this running)

ssh -NL 2222:server2.example.com:22 server1.example.com

Test connection with ssh locally

ssh localhost 2222

So in your case, Netbeans just need to connect to localhost port 2222.

Ref: https://www.ssh.com/ssh/tunneling/example

0

That isn't answer you expect, but to big to put it in comment.

I think best solution is configure autostart some service which will create tunnel to first server on your login and bind local port (let's say 2222) to second remote server ssh port. This is basical feature of ssh client. When you can configure Netbeans to connect to localhost:2222 and login right into second server. You might need to use keys authentication for first server.

Where are examples to make such thing. Like is underneath link on article

http://www.pc-freak.net/blog/start-ssh-tunnel-pc-boots-windows-alwaysup/

0

Since you can get ssh access via a daisy-chain, you can very likely use SSHFS:

https://github.com/libfuse/sshfs

Available in Debian (and therefore, likely many other distributions):

https://packages.debian.org/jessie/sshfs

As long as you have ssh keys set up properly on each server, you can daisy-chain mounting via SSHFS to the machine where your NetBeans app is running.

https://en.wikipedia.org/wiki/SSHFS

NOTE: There are some caveats, including that SSHFS expects that it is the only mechanism used to update the filesystem, and that there is only one writer at a time. Undesirable behavior can occur if you allow other mechanisms to change the files or directories on the target server, including data loss and/or corruption.

Not the answer you're looking for? Browse other questions tagged or ask your own question.