用于sftp或GUI的ssh隧道

时间:2011-02-21 00:15:32

标签: user-interface ftp sftp ssh-tunnel nautilus

我正在尝试在ssh隧道上使用sftp

我有homePC,可以使用gatewayPC作为跳转主机登录到远程服务器

我使用ssh tunnel命令

$ssh -t userid@gateway ssh remoteserver

来自homePC,效果很好

但是,我想在登录其他计算机后打开nautilus或任何其他文件管理器

一个选项是能够通过此隧道进行sftp或ftp

是否有基于GUI的工具,如putty for windows,以实现这一目标?

感谢任何帮助

此致 Shivani

4 个答案:

答案 0 :(得分:3)

为此你可以使用ssh隧道,你必须在路径中创建一个文件:

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

并添加此文本(使用您的服务器进行调整):

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

通过这个例子,您可以直接从gatewayPC转到localPC,只需在终端中运行:

atiruz@pc:~$ ssh root@localPC

该方案应如this site中所述。 (我做了一个小改动,因为在这个网站的例子中我的Ubuntu 12.04没有工作)。

您也可以在Nautilus中使用它,并使用以下路径:

在终端中:atiruz@pc:~$ nautilus sftp://root@localPC

或直接在Nautilussftp://root@localPC

答案 1 :(得分:0)

我不确定做这样的事情的“正确”方法是什么,但我做了类似的事情,创建了一个从homePC到gatewayPC的端口转发,然后从gatewayPC到remoteserver。然后我可以将本地SFTP客户端连接到端口转发管道的本地端。但是,这会使您加密一倍。

答案 2 :(得分:0)

我建议使用“ssh -fND 6789 gatewayPC”,然后使用configure tsocks,这样就可以执行'tsocks sshfs remoteserver:/ mnt / remoteserver“。第一个命令设置一个SOCK5代理,将所有TCP请求隧道传送到gatewayPC.tsocks命令包含给定使用SOCKS5代理的命令的网络调用.ssshf让你使用sftp挂载一个远程文件系统。

答案 3 :(得分:0)

你的问题不明确,所以这里有两个答案:

如果您只想在远程主机上运行基于X的文件管理器应用程序,请确保每-X ssh生效homepc% ssh -X me@gatewaypc ...Authenticate... gatewaypc% ssh -X me@otherpc ...Authenticate... otherpc% some-x-application ...X application displays on homepc...

scp

如果您希望使用homepc% ssh -L2222:otherpc:22 me@gatewaypc ...Authenticate... gatewaypc% (Don't do anything here)

进行直接文件复制
scp

然后您可以在转发端口上执行homepc% scp -P 2222 me@localhost:~/path/to/file /where/it/goes

{{1}}