ssh tunneling for sftp or GUI

假装没事ソ 提交于 2019-12-12 08:17:43

问题


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


回答1:


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




回答2:


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.




回答3:


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.




回答4:


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


来源:https://stackoverflow.com/questions/5061116/ssh-tunneling-for-sftp-or-gui

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!