I have a source folder
-rw-r--r-- 1 27773 27773 12 Mar 23 21:41 aws-1 -rw-r--r-- 1 27773 27773 12 Mar 23 21:41 aws-2
the destination folder doesn't exist yet. And I try to rsync the 2 aws files into a destination folder. Here is my command:
rsync \ --include="aws*" \ --exclude="*" \ -avh --chmod=a=rw "source/." "destination"
What I'm trying to do is to rsync the 2 aws files and change their permissions once in the destination folder. After running the command, I got an error and the files are not in the destination folder. Only the folder is created. Here is the error:
sending incremental file list created directory destination rsync: failed to modify permissions on "/home/cg/root/destination/.": Permission denied (13) rsync: recv_generator: failed to stat "/home/cg/root/destination/aws-1": Permission denied (13) rsync: recv_generator: failed to stat "/home/cg/root/destination/aws-2": Permission denied (13) ./ sent 88 bytes received 346 bytes 868.00 bytes/sec total size is 24 speedup is 0.06 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1165) [sender=3.1.1]
It says permission denied without copying the files. I don't already understand which permission cause problem. My source file and directory seems fine. The created destination folder seems also fine.
PS: I precise my rsync command happens inside a bash script