1

I have a source folder

source/

-rw-------@ 1 user  staff    41B Mar 23 13:59 aws-1
-rw-r--r--  1 user  staff   112B Mar 23 14:36 aws-2
-rw-rw-rw-@ 1 user  staff   2.3K Feb  5 17:15 google

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 \
  -avh --chmod=a=rw \
  --include="aws-*" \
  --exclude="*" \
  "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:

building file list ... done
created directory /Users/user/destination/aws
./
rsync: recv_generator: failed to stat "/Users/user/destination/aws/aws-1": Permission denied (13)
rsync: recv_generator: failed to stat "/Users/user/destination/aws/aws-2": Permission denied (13)
rsync: recv_generator: mkdir "/Users/user/destination/aws/." failed: Permission denied (13)
*** Skipping everything below this failed directory ***

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

eakl
  • 121
  • http://unix.stackexchange.com/questions/10/what-does-the-mean-in-ls-l – ctx Mar 23 '17 at 15:55
  • Thanks but I don't really understand what should I do with the xattr. Should I remove or edit them? One file has it, the other hasn't and the error says permission denied for both. – eakl Mar 23 '17 at 16:20
  • Read about attributes, check them for the directory /Users/user/destination/ and update your question to disclose that it is a problem with attributes. The link answers why you see the errors, but you didn't ask a real question. – ctx Mar 23 '17 at 16:43
  • I have updated the original post. One the destination folder is created, empty though, I tried xattr -l destination but it shows nothing. – eakl Mar 23 '17 at 19:57
  • the source file shows com.apple.TextEncoding: utf-8;134217984 and com.apple.metadata:kMDLabel_opewstnruelznhfy6in7kkdv54 with xattr -l source/aws-1. Removing the attributes from aws-1 doesn't solve the problem – eakl Mar 23 '17 at 20:15

1 Answers1

1

The solution is to use --chmod=a=rwX where the X allows the traversal

rsync\
--include="aws*" \
--exclude="*" \
-avh --chmod=a=rwX 
source/ destination/

The detailed answer on askubuntu

eakl
  • 121