Rsync: failed to set times on

Fix the Rsync 'failed to set times on: Operation not permitted' error caused by ownership mismatches, NFS mounts, and non-Unix filesystems.

Rsync produces the "failed to set times on" message when the destination filesystem or user permissions do not allow modifying file or directory timestamps.

When Rsync Produces This Error

Rsync produces "failed to set times on" when transferring files to a destination directory owned by a different user. The error appears as:

rsync: failed to set times on "/destination_folder/." : Operation not permitted (1)

Rsync also produces "failed to set times on" when the destination is an NFS-mounted directory with root_squash enabled. The NFS server maps root to nobody, preventing Rsync from calling utimes() on files and directories.

Rsync triggers this error on FAT32 and exFAT filesystems that store timestamps with 2-second precision. Rsync detects a timestamp mismatch after setting the time and reports the error, even though the timestamp was set to the closest supported value.

What Causes the "failed to set times on" Error in Rsync

Rsync's archive mode ( -a flag) includes the -t (preserve times) option by default. Rsync calls the utimes() system call on each destination file and directory to replicate the source modification timestamp. The Linux kernel returns EPERM (Operation not permitted, error code 1) when the calling user does not own the target file.

Rsync attempts to set the modification time on the directory itself(shown as /destination_folder/. in the error message), not only on individual files. Unix systems require the directory owner or root to modify a directory's timestamps. A non-owner user can create files inside a directory with write permission but cannot change the directory's own modification time.

Rsync encounters the same EPERM error on NFS mounts where root_squash remaps the root user to an unprivileged nobody account. Root on the NFS client loses the ability to call utimes() on files owned by other users on the NFS server.

How to Fix "failed to set times on" in Rsync

  1. Fix ownership on the destination directory.Change the destination directory and all its contents to be owned by the user running Rsync. Use the -h flag to also change ownership of symbolic links.

    sudo chown -hR $(whoami) /destination_folder/

    Rsync can now call utimes() on the destination because the running user owns the directory and its files.

  2. Add the --omit-dir-times ( -O) flagto skip setting modification times on directories. Rsync still preserves file timestamps but does not attempt to modify directory timestamps.

    rsync -aO /home/user/src/ /destination_folder/

    Rsync transfers files with archive mode but skips the utimes() call on directories, avoiding the EPERM error.

  3. Use explicit flags without -twhen timestamp preservation is not required. Replace -a (archive) with -rl (recursive + symlinks) to skip timestamp preservation entirely.

    rsync -rl /home/user/src/ /destination_folder/

    Rsync copies files recursively and preserves symlinks but does not attempt to set modification times on files or directories.

  4. Use checksum-based comparison with selective flagswhen timestamps are unreliable but file integrity matters. The -c (checksum) flag compares files by content instead of modification time.

    rsync -crlt /home/user/src/ user@203.0.113.10:/destination_folder/

    | Flag | Description | |------|-------------| | -c| Compares files by checksum instead of modification time and size. | | -r| Recursive directory sync. | | -l| Preserves symbolic links. | | -t| Preserves modification times on files (combined with -c for checksum-based sync). |

  5. Run Rsync as rooton native Unix filesystems (ext4, XFS, Btrfs) when the transfer requires preserving timestamps across different file owners.

    sudo rsync -a /home/user/src/ /destination_folder/

How to Verify the Fix

Rsync completes the transfer without "failed to set times on" warnings when the fix is applied. Run the transfer and verify clean output.

rsync -aO /home/user/src/ /destination_folder/

Rsync prints the file list and summary without timestamp error messages. Verify that the destination files match the source.

rsync -avni /home/user/src/ /destination_folder/

Rsync outputs nothing when source and destination are identical.

Edge Cases and Variations

Rsync produces "failed to set times on" on FAT32 destinations because FAT32 stores timestamps with 2-second resolution. Add --modify-window=1 to allow a 1-second tolerance when comparing timestamps. Rsync treats timestamps within this window as equal.

rsync -av --modify-window=1 /home/user/src/ /mnt/fat32-drive/dest/

Rsync produces "failed to set times on" when syncing to a remote server where the user account has write permission to a directory but does not own it. The remote chown fix requires root access on the remote machine.

Rsync produces "failed to set times on" with macOS APFS volumes in certain Time Machine configurations. Add -O to skip directory timestamp modification on APFS destinations.

Rsync: failed to set permissions on-- caused by the same filesystem and ownership issues that prevent permission changes.

Rsync: error in rsync protocol data stream-- destination permission and ownership problems can contribute to protocol data stream errors.