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
--产出是
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包含
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
...which在16.04上工作,所以我想知道是否有bug,尽管我很感激其他的建议,因为我不知道如何进一步调试/调查。
发布于 2019-06-03 07:18:30
这个问题似乎是由ssh选项中的-tt
引起的,我从某个地方找到了这个选项,作为解决另一个错误的潜在解决方案。
在纠正了脚本中的远程路径错误后,当从ssh选项中删除-tt
时,它将按照预期的方式工作。
https://askubuntu.com/questions/1145726
复制相似问题