22

I am trying to rsync files from one server to another but getting this error

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

Can someone help me why so ?

I guess it is some permissions issue.

This is my command:

RSYNC=/usr/bin/rsync
SSH=/usr/bin/ssh
REMOTE_HOST=test.desktop

${RSYNC} -crlt -e ${SSH} ${LOCAL_DIR} ${REMOTE_HOST}:${REMOTE_DIR}

LOCAL_DIR = workplace1/f1/
permissions drwxr-xr-x   11 root     root         4096 Mar 19  2009 f1

REMOTE_DIR=/dept/intranet/dept/atest/f1/
permissions :drwxr-xr-x 14 dbld   a1     4096 Mar 19  2009 f1     
2
  • could you give us more information? * your rsync command * local+remote user * file permissions Oct 14, 2010 at 11:53
  • edited the question.
    – TopCoder
    Oct 14, 2010 at 12:07

3 Answers 3

30

Just so we're on the same page:

-r recursive
-l preserve links
-c sync based on file checksum
-t preserve modification times

Then two things:

It's just a filesystem thingy

If the destination folder is a NFS mount, or some filesystem that doesn't handle well mod-times, well it breaks.

Try adding the -O (for --omit-dir-times) parameter to your command.

Modification times will be preserved, but omitted for directories:

${RSYNC} -crlOt -e ${SSH} ${LOCAL_DIR} ${REMOTE_HOST}:${REMOTE_DIR}

This is my best guess, since file sync seems to work, and your error happens on mod time sync. Anyway, do you really need to preserve modification times? The -c option skip files based on checksum (so mod times doesn't matter).

Or it is, actually, a permission problem

  • does the user running the script have enough privileges to edit/write the destination folder? (try ssh -vv test.desktop "touch /dept/intranet/dept/atest/f1/test")
  • does the user running the script is "the Right One™" (try ssh -vv [email protected] "touch /dept/intranet/dept/atest/f1/test")

None of the above

Run your command with the -v option, for verbose.

0
6

Add -O (--omit-dir-times) to your command line to avoid it trying to set modification times on directories.

Also read this: https://stackoverflow.com/questions/667992/rsync-error-failed-to-set-times-on-foo-txt-operation-not-permitted

2

In my case I've solved the problem by granting permissions on the parent directory where the sync was taken place.

Actually the owner of the parent directory was other than the user doing the sync.

You must log in to answer this question.