使用 rsync 时是否可以指定不同的 ssh 端口? [英] Is it possible to specify a different ssh port when using rsync?

查看:32
本文介绍了使用 rsync 时是否可以指定不同的 ssh 端口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试以下命令:

I have been attempting the following command:

rsync -rvz --progress --remove-sent-files ./dir user@host:2222/path

SSH 在 2222 端口上运行,但 rsync 仍然尝试使用端口 22,然后抱怨找不到路径,因为它当然不存在.

SSH is running on port 2222, but rsync still tries to use port 22 and then complains about not finding the path, cause of course it does not exist.

我想知道是否可以通过非标准 ssh 端口 rsync 到远程主机.

I would like to know if it is possible to rsync to a remote host on a non-standard ssh port.

推荐答案

另一个选项,在你运行 rsync 的主机中,在 ssh 配置文件中设置端口,即:

Another option, in the host you run rsync from, set the port in the ssh config file, ie:

cat ~/.ssh/config
Host host
    Port 2222

然后通过 ssh 的 rsync 将与端口 2222 通信:

Then rsync over ssh will talk to port 2222:

rsync -rvz --progress --remove-sent-files ./dir user@host:/path

这篇关于使用 rsync 时是否可以指定不同的 ssh 端口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆