首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >rsync与远程sudo在Ubuntu Mate 18.04.2上的ssh上失败

rsync与远程sudo在Ubuntu Mate 18.04.2上的ssh上失败
EN

Ask Ubuntu用户
提问于 2019-05-23 19:54:25
回答 1查看 2.1K关注 0票数 1

rsync与远程sudo在Ubuntu Mate 18.04.2上的ssh上失败

rsync版本3.1.2协议版本31 -本地和远程版本相同

OpenSSH_7.6p1 Ubuntu-4 ubuntu0.3,OpenSSL 1.0.2n 2017年12月7日-本地和远程相同

我已经检查了来自.bashrc的虚假输出

$ ssh user@host /bin/true > out.dat

这会导致

$ ls -l *.dat -rw-rw-r-- 1 user user 0 May 22 23:33 out.dat

-命令是

rsync -AEavvvogt --rsync-path="sudo rsync" --debug=CONNECT -e "ssh -i /home/xxx/.ssh/id_rsa -tt -v -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" --exclude-from=/home/xxx/backup.exclude --delete --link-dest=../$lastdt /etc $dest/$dt

--产出是

代码语言:javascript
运行
复制
opening connection using: ssh -i /home/user/.ssh/id_rsa -tt -v -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -l user xxx "sudo rsync" --server -vvvlogDtpAre.iLsfxC --delete --link-dest ../20190506_021137 . /home/backups/xxx/20190522_232738 (20 args)

OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n 7 Dec 2017

debug1: Reading configuration data /etc/ssh/ssh_config

debug1: /etc/ssh/ssh_config line 19: Applying options for *

debug1: Connecting to xxx [192.168.1.120] port 22.

debug1: Connection established.

debug1: permanently_set_uid: 0/0

debug1: identity file /home/user/.ssh/id_rsa type 0

debug1: key_load_public: No such file or directory

debug1: identity file /home/user/.ssh/id_rsa-cert type -1

debug1: Local version string SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.3

debug1: Remote protocol version 2.0, remote software version OpenSSH_7.6p1 Ubuntu-4ubuntu0.3

debug1: match: OpenSSH_7.6p1 Ubuntu-4ubuntu0.3 pat OpenSSH* compat 0x04000000

debug1: Authenticating to xxx:22 as 'user'

debug1: SSH2_MSG_KEXINIT sent

debug1: SSH2_MSG_KEXINIT received

debug1: kex: algorithm: curve25519-sha256

debug1: kex: host key algorithm: ecdsa-sha2-nistp256

debug1: kex: server->client cipher:  MAC:  compression: none

debug1: kex: client->server cipher:  MAC:  compression: none

debug1: expecting SSH2_MSG_KEX_ECDH_REPLY

debug1: Server host key: xxx

Warning: Permanently added 'xxx,192.168.1.120' (ECDSA) to the list of known hosts.

debug1: rekey after 134217728 blocks

debug1: SSH2_MSG_NEWKEYS sent

debug1: expecting SSH2_MSG_NEWKEYS

debug1: SSH2_MSG_NEWKEYS received

debug1: rekey after 134217728 blocks

debug1: SSH2_MSG_EXT_INFO received

debug1: kex_input_ext_info: server-sig-algs=

debug1: SSH2_MSG_SERVICE_ACCEPT received

debug1: Authentications that can continue: publickey,password

debug1: Next authentication method: publickey

debug1: Offering public key: RSA SHA256:xxx /home/user/.ssh/id_rsa

debug1: Server accepts key: xxx

debug1: Authentication succeeded (publickey).

Authenticated to xxx ([192.168.1.120]:22).

debug1: channel 0: new [client-session]

debug1: Requesting 

debug1: Entering interactive session.

debug1: pledge: network

debug1: client_input_global_request: rtype  want_reply 0

debug1: tty_make_modes: no fd or tio

debug1: Sending environment.

debug1: Sending env LANG = en_GB.UTF-8

debug1: Sending command: sudo rsync --server -vvvlogDtpAre.iLsfxC --delete --link-dest ../20190506_021137 . /home/backups/xxx/20190522_232738

protocol version mismatch -- is your shell clean?

(see the rsync man page for an explanation)

rsync error: protocol incompatibility (code 2) at compat.c(178) [sender=3.1.2]

[sender] _exit_cleanup(code=2, file=compat.c, line=178): about to call exit(2)

/etc/sudoers包含

代码语言:javascript
运行
复制
user ALL= NOPASSWD:/usr/bin/rsync

...which我已经尝试过放置在上面(默认情况下),下面的行开始%admin和%sudo以及"ALL= NOPASSWD.“中的空格。似乎没什么区别

我按照指示在

https://www.digitalocean.com/community/tutorials/how-to-copy-files-with-rsync-over-ssh

在目标机器上使用rsync和sudo

...which在16.04上工作,所以我想知道是否有bug,尽管我很感激其他的建议,因为我不知道如何进一步调试/调查。

EN

回答 1

Ask Ubuntu用户

回答已采纳

发布于 2019-06-03 07:18:30

这个问题似乎是由ssh选项中的-tt引起的,我从某个地方找到了这个选项,作为解决另一个错误的潜在解决方案。

在纠正了脚本中的远程路径错误后,当从ssh选项中删除-tt时,它将按照预期的方式工作。

票数 1
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/1145726

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档