Skip to content
ohsudo, Home
Linux

rsync "some files/attrs were not transferred (code 23)": the real error is further up

Fix rsync "some files/attrs were not transferred (code 23)": find the real errors above it, then fix permissions, owners on FAT, NTFS or SMB, or names.

Beginner3 min readApplies to rsync 3.x · Linux · macOS

by OhSudo ·

Checked on real software: rsync, Linux · November 2026How we check

rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]

This line is only a summary. rsync copied what it could, and some files or some of their details, like owner or permissions, failed. The reasons are in the lines printed earlier, as the message says: “see previous errors”. In a long copy, those scrolled away.

So the first step is always the same: find those lines.

TL;DR

Terminal window
rsync -a /src/ /dest/ 2>&1 >/dev/null | grep -v '^$'

That shows only the errors. Then:

  • Permission denied reading: run with sudo, or exclude those files.
  • failed to set permissions or chown ... Operation not permitted on a USB disk or share: copy without owners and permissions, with rsync -rlt.

1. Show only the errors

rsync writes errors to standard error, and the file list to standard output. Keep the first, drop the second:

Terminal window
rsync -a /src/ /dest/ 2>&1 >/dev/null | grep -v '^$'

Or keep a log you can read afterwards:

Terminal window
rsync -a --log-file=/tmp/rsync.log /src/ /dest/
grep -E 'rsync: |failed' /tmp/rsync.log

2. Files you can’t read

rsync: [sender] send_files failed to open "/src/secrets.key": Permission denied (13)
rsync: [sender] opendir "/src/private" failed: Permission denied (13)

As an ordinary user, you can’t read some files. For a full backup, run it as root, with sudo, on the side doing the reading. Over SSH, the remote side needs --rsync-path="sudo rsync", and that user needs passwordless sudo for rsync.

If you don’t need those files, exclude them:

Terminal window
rsync -a --exclude 'private/' /src/ /dest/

3. A destination that can’t store Linux permissions

FAT and exFAT USB disks, NTFS, and many SMB shares have no Linux owners or permissions. -a asks for both, so each file produces an error:

rsync: [receiver] chown "/mnt/usb/file.txt" failed: Operation not permitted (1)
rsync: [receiver] failed to set permissions on "/mnt/usb/file.txt": Operation not permitted (1)

The files themselves were copied. Ask only for what the destination can keep:

Terminal window
rsync -rlt /src/ /mnt/usb/

That’s -a without owner, group, permissions and devices: recursive, links, and times. Or keep -a and switch parts off: rsync -a --no-owner --no-group --no-perms. FAT stores times with 2-second steps, so add --modify-window=1 there, or rsync recopies every file each time.

NFS with root_squash maps root to an unprivileged user on the server, so sudo rsync -a can’t set owners there either. Use the options above, or change the export if you need owners kept.

4. Names the destination doesn’t accept

Windows file systems refuse names containing :, ?, *, ", <, >, | or \, and names ending with a space or a dot:

rsync: [receiver] mkstemp "/mnt/usb/.report: final.pdf.Xa12bc" failed: Invalid argument (22)

Rename those files at the source, or exclude them. Very long paths fail in the same way.

5. Code 23 or 24

rsync warning: some files vanished before they could be transferred (code 24)

Code 24 is milder: files were deleted while rsync was running, typically logs and temporary files. It’s normal on a live system. In a backup script, you can treat 24 as success:

Terminal window
rsync -a /src/ /dest/
rc=$?
if [ "$rc" -ne 0 ] && [ "$rc" -ne 24 ]; then
echo "rsync failed with code $rc" >&2
exit "$rc"
fi

Don’t do the same with 23, which means something you wanted wasn’t copied.

6. Run it again, to check

rsync only copies what’s different, so a second run is quick, and should end with no errors. Add -n and -i to see what it would still change, without changing anything:

Terminal window
rsync -a -n -i /src/ /dest/

Warning

Don’t hide this with 2>/dev/null, or by treating every exit code as success in a backup script. Code 23 means files are missing from the copy, and you’d only find out when you need to restore them. Also take care with --delete, which removes files at the destination that aren’t in the source: try it with -n first.

Shell, we have a problem!

Similar, but different: rsync: connection unexpectedly closed (code 12) and code 255 come from the SSH connection: see Permission denied (publickey) if it never logs in. No space left on device (28) means the destination is full: see that article. Permission denied when running a script is about the execute bit.

Found this useful? Share it.

Found a mistake? Let us know at contact@ohsudo.com.

Articles

Related articles