ssh tunneling for sftp or GUI

16k views Asked by At

I am trying to use sftp over an ssh tunnel

I have a homePC, that can use a gatewayPC as a jump host to login to a remoteserver

i use the ssh tunnel command

$ssh -t userid@gateway ssh remoteserver

from homePC and it worked great

However, I would like to open a nautilus or any other file manager once I am logged into the other machine

one option is to be able to sftp or ftp over this tunnel

Are there GUI based tools like putty for windows in order to make this happen?

Any help is appreciated

Regards, Shivani

5

There are 5 answers

0
Paŭlo Ebermann On

I'm not sure what the "right" way to do something like this would be, but I did something similar once by creating a port-forwarding from homePC to gatewayPC, and then from gatewayPC to remoteserver. Then I can connect my local SFTP client to the local end of the port-forwarding pipeline. This gets you doubled encryption, though.

0
Kevin Bryan On

I would suggest using an "ssh -fND 6789 gatewayPC", then use configure tsocks so you can do 'tsocks sshfs remoteserver: /mnt/remoteserver". The first command sets up a SOCK5 proxy that tunnels all TCP requests through to gatewayPC. The tsocks command wraps the network calls of the command given to use a SOCKS5 proxy. sshfs let's you mount a remote file system using sftp.

1
Blrfl On

Your question wasn't clear, so here are two answers:

If you just want to be able to run an X-based file manager application on the remote host, just make sure -X is in effect through every ssh:

homepc% ssh -X me@gatewaypc
  ...Authenticate...
gatewaypc% ssh -X me@otherpc
  ...Authenticate...
otherpc% some-x-application
  ...X application displays on homepc...

If you're looking to do direct file copies with scp,

homepc% ssh -L2222:otherpc:22 me@gatewaypc
  ...Authenticate...
gatewaypc%  (Don't do anything here)

Then you can just do scp on the forwarded port

homepc% scp -P 2222 me@localhost:~/path/to/file /where/it/goes
0
Zhanwen Chen On
Host gateway
  HostName gateway.example.com
  User me
  IdentityFile ~/.ssh/id_rsa

Host serv1
  HostName server1ShortName
  CheckHostIP no
  HostKeyAlias server1ShortName
  User myname
  IdentityFile ~/.ssh/id_rsa

  #ProxyJump gateway # This is equivalent, but Transmit only recognizes `ProxyCommand`
  ProxyCommand ssh -W %h:%p gateway
0
atiruz On

For that you can use ssh tunnel you must create a file in the path:

atiruz@pc:~$ nano ~/.ssh/config

And add this text (adjusted with your servers):

Host gatewayPC
    HostName 100.110.120.130

Host localPC
    ProxyCommand ssh -A -t root@gatewayPC -p 222 nc 192.168.1.5 22

Host otherPC
    ProxyCommand ssh -A -t localPC nc 10.10.0.55 22

With this example you can go directly from the gatewayPC to the localPC, just run in a terminal:

atiruz@pc:~$ ssh root@localPC

The scheme should be as described in this site. (I made a small change, because in the example of this site did not work on my Ubuntu 12.04).

You can also use it in Nautilus with the following path to be used as follows :

Either in a Terminal: atiruz@pc:~$ nautilus sftp://root@localPC

Or directly in Nautilus: sftp://root@localPC