2015-08-22 67 views
0

复制本地文件夹到远程服务器。当我需要从local_host复制folder_01到remote_server的,而在local_host执行语法我用下面的语法查询:rsync的 - 从远程服务器

[email protected]:~/local_directory/$rsync -avz --progress folder_01/ -e ssh [email protected]:/home/user/remote_directory/folder_01/ 

怎样一个副本folder_01从local_host到remote_server,但是这次在remote_server上执行语法?

这是因为出于安全原因,我不再允许将ssh直接登录到remote_server(xxx.xxx.xx.xx)而没有登录ssh到中间remote_server(zzz.zzz.zz.zz)。

想要试验一下,如果我能够在登录到remote_server后将文件从local_host拉到remote_server。谷歌搜索,并分享的例子不包括上述案件。

希望你能指导。

回答

0

这不是一个rsync问题,这是一个ssh问题。

只需添加到您的.ssh/config文件和所有应该工作:

Host xxx.xxx.xx.xx 
    ProxyCommand ssh zzz.zzz.zz.zz -W %h:%p 

这只是说,每当我到z要求X,隧道到那里。如果您的用户名不匹配,您可能需要摆弄用户设置。