Repository navigation
Open
Description
I want to copy some files from a remote host to my local machine and the files are owned by a different user. My user has sudo permissions so I provided sudo rync as the --rsync-path. I also forced pseudo tty allocation via the ssh option in order to get a prompt to enter the password for the remote user.
However, when running
rsync -vvv --dry-run -Aavx -e "ssh -tt" --rsync-path "sudo rsync" "maple:/var/lib/nextcloud" "/run/media/eXia/server-backup/nextcloud-backup_$(date +"%Y%m%d")/"
I get this protocol mismatch error where the remote version is a large number: 1685418843
cmd=ssh -tt machine=maple user=<NULL> path=/var/lib/nextcloud
cmd[0]=ssh cmd[1]=-tt cmd[2]=maple cmd[3]=sudo rsync cmd[4]=--server cmd[5]=--sender cmd[6]=-vvvvnlogDtpArxe.iLsfxCIvu cmd[7]=. cmd[8]=/var/lib/nextcloud
opening connection using: ssh -tt maple "sudo rsync" --server --sender -vvvvnlogDtpArxe.iLsfxCIvu . /var/lib/nextcloud (9 args)
msg checking charset: UTF-8
(Client) Protocol versions: remote=1685418843, negotiated=32
protocol version mismatch -- is your shell clean?
(see the rsync manpage for an explanation)
[Receiver] _exit_cleanup(code=2, file=compat.c, line=622): entered
rsync error: protocol incompatibility (code 2) at compat.c(622) [Receiver=3.4.1]
[Receiver] _exit_cleanup(code=2, file=compat.c, line=622): about to call exit(2) (DRY RUN)
I checked for any startup commands that may run for the remote non interactive shell via
ssh maple -- : > out.datwhich creates a zero byte file which seems to indicate no garbage is getting outputted to the shell
$ ls -al out.dat
.rw-r--r-- 0 eXia 20 Jun 13:40 out.datI also checked that the local and remote versions of rsync are in sync
local:
$ rsync --version
rsync version 3.4.1 protocol version 32
Copyright (C) 1996-2025 by Andrew Tridgell, Wayne Davison, and others.
Web site: https://rsync.samba.org/
Capabilities:
64-bit files, 64-bit inums, 64-bit timestamps, 64-bit long ints,
socketpairs, symlinks, symtimes, hardlinks, hardlink-specials,
hardlink-symlinks, IPv6, atimes, batchfiles, inplace, append, ACLs,
xattrs, optional secluded-args, iconv, prealloc, stop-at, no crtimes
Optimizations:
SIMD-roll, no asm-roll, openssl-crypto, no asm-MD5
Checksum list:
xxh128 xxh3 xxh64 (xxhash) md5 md4 sha1 none
Compress list:
zstd lz4 zlibx zlib none
Daemon auth list:
sha512 sha256 sha1 md5 md4
rsync comes with ABSOLUTELY NO WARRANTY. This is free software, and you
are welcome to redistribute it under certain conditions. See the GNU
General Public Licence for details.remote:
$ ssh maple rsync --version
rsync version 3.4.1 protocol version 32
Copyright (C) 1996-2025 by Andrew Tridgell, Wayne Davison, and others.
Web site: https://rsync.samba.org/
Capabilities:
64-bit files, 64-bit inums, 64-bit timestamps, 64-bit long ints,
socketpairs, symlinks, symtimes, hardlinks, hardlink-specials,
hardlink-symlinks, IPv6, atimes, batchfiles, inplace, append, ACLs,
xattrs, optional secluded-args, iconv, prealloc, stop-at, no crtimes
Optimizations:
SIMD-roll, no asm-roll, openssl-crypto, no asm-MD5
Checksum list:
xxh128 xxh3 xxh64 (xxhash) md5 md4 sha1 none
Compress list:
zstd lz4 zlibx zlib none
Daemon auth list:
sha512 sha256 sha1 md5 md4
rsync comes with ABSOLUTELY NO WARRANTY. This is free software, and you
are welcome to redistribute it under certain conditions. See the GNU
General Public Licence for details.Any ideas what else might be causing this?
Metadata
Metadata
Assignees
Labels
No labels
Activity
mewoocat commentedon Jul 4, 2026
After further testing, I've found that just adding the
-ttoption to the ssh command causes rsync to fail with this corrupted protocol version. I tried runningssh 0tt maple -- : > out.datand checking the output size but it still results in a zero byte file. There's got to be something outputting to stdout somewhere right? Somehowssh -ttcauses it.steadytao commentedon Jul 7, 2026
This is very likely caused by forcing a TTY with
ssh -ttespecially ifsudomay prompt or emit terminal/control output. Rsync needs the remote stdout/stderr protocol stream to stay clean. I would avoid-ttand configure sudoers for the exact rsync command then use something like--rsync-path='sudo -n rsync'so it either runs non-interactively or fails cleanly instead of writing a password prompt into the stream.