Why drush fails to rsync between my two local instances? I'm trying to synchronize two local drupal repositories using the following command:

drush rsync


My environment:
 - drush 6.1
 - Mac os X 10.9
 - drupal 7.24

I have followed standard security recommendations for Drupal and configured
permissions with:

MBPC:files pc$ pwd
/Users/pc/Sites/mysite.dev/sites/default/files
MBPC:files pc$ ls -al
total 8
drwxrwx---+ 8 _www  staff  272 18 jul  2012 .
drwxr-xr-x+ 4 pc    staff  136 23 nov 15:08 ..
-rwxr-----+ 1 pc    _www   477 21 nov 15:19 .htaccess
drwxrwxr-x+ 3 _www  staff  102 18 jul  2012 color
drwxr-xr-x+ 3 _www  staff  102 22 nov 09:53 ctools
drwxr-x---+ 3 _www  staff  102 23 mai  2012 pictures
drwxr-x---+ 3 _www  staff  102 23 nov 16:24 private
drwxr-xr-x+ 2 _www  staff   68 24 oct 17:37 styles


The user pc is a member of the _www group.

The .htaccess file contains (following the latests Drupal security warnings) as follows:

# Turn off all options we don't need.
Options None
Options +FollowSymLinks

# Set the catch-all handler to prevent scripts from being executed.
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
&lt;Files *&gt;
  # Override the handler again if we're run later in the evaluation list.
  SetHandler Drupal_Security_Do_Not_Remove_See_SA_2013_003
&lt;/Files&gt;

# If we know how to do it safely, disable the PHP engine entirely.
&lt;IfModule mod_php5.c&gt;
  php_flag engine off
&lt;/IfModule&gt;


There is a similar .htaccess file in the private subdirectory.

I'm using the following command: 

$ drush rsync @mysite.dev @mysite.local 


and I get this error message: 

You will destroy data from /Users/pc/Sites/mysite.local/ and replace with data from /Users/pc/Sites/mysite.dev//
Do you really want to continue? (y/n): y
rsync: failed to set times on "/Users/pc/Sites/mysite.local/sites/default/files": Operation not permitted (1)
rsync: recv_generator: mkdir "/Users/pc/Sites/mysite.local/sites/default/files/color" failed: Permission denied (13)
*** Skipping everything below this failed directory ***
rsync: recv_generator: mkdir "/Users/pc/Sites/mysite.local/sites/default/files/ctools" failed: Permission denied (13)
*** Skipping everything below this failed directory ***
rsync: recv_generator: mkdir "/Users/pc/Sites/mysite.local/sites/default/files/pictures" failed: Permission denied (13)
*** Skipping everything below this failed directory ***
rsync: recv_generator: mkdir "/Users/pc/Sites/mysite.local/sites/default/files/private" failed: Permission denied (13)
*** Skipping everything below this failed directory ***
rsync: mkstemp "/Users/pc/Sites/mysite.local/sites/default/files/..htaccess.bVe3a4" failed: Permission denied (13)
rsync: failed to set permissions on "/Users/pc/Sites/mysite.local/sites/default/files/styles": Operation not permitted (1)
rsync: failed to set times on "/Users/pc/Sites/mysite.local/sites/default/files": Operation not permitted (1)
rsync: failed to set permissions on "/Users/pc/Sites/mysite.local/sites/default/files/styles": Operation not permitted (1)
rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-42/rsync/main.c(992) [sender=2.6.9]
Could not rsync from /Users/pc/Sites/mysite.dev// to /Users/pc/Sites/mysite.local/                                                              [error]
You cannot change the file timestamps or change permissions by being a member of a group, you have to be the file owner, or root. If you cannot be the other of that file, you might need to avoid trying to set permissions at all.

So you may try to modify your drushrc file (e.g. sites/default/drushrc.php) and add the following arguments for rsync command:

$command_specific['rsync'] = array('mode' =&gt; 'rlptzO', 'verbose' =&gt; TRUE, 'no-perms' =&gt; TRUE);


If running rsync on remotes, edit your aliases.drushrc file (e.g. sites/default/aliases.drushrc.php) and add something like:

$aliases['mysite.dev'] = array(
    // here are your settings such as uri, root, remote-host, etc.

    'command-specific' =&gt; array (
      'rsync' =&gt; array('mode' =&gt; 'rlptzO', 'verbose' =&gt; TRUE, 'no-perms' =&gt; TRUE),
    ),
);