How to set up drush aliases for a local server for rsync? I'd like to use drush to sync files from local server to production server. I have edited the aliases.drushrc.php file and placed inside /drush/aliases in both local and remote machines. Everything seems to work fine except that drush understands that both sites are in the same server since I do not know how to tell drush that local is in another machine in my local server.
I guess it's something to do with uri but I do not know what should I write there.

I've tried with this:

$aliases['local'] = array(
  'uri'  =&gt; 'mysite.localhost',    
  'root' =&gt; '/home/user/www/mysite',
);


and this:

$aliases['local'] = array(
  'uri'  =&gt; 'localhost/mysite',    
  'root' =&gt; '/home/user/www/mysite',
);


being mysite the name of the folder placed in /home/user/www in my local server, but none of them seem to work.

Anyone can tell me what am I doing wrong?

EDIT:

I have placed mysite.aliases.drushrc.php in my local sites folder.
However I didn't succeed with the following code in my local site:

drush rsync @mysite.live:%files @mysite.local:%files


This is what I get:


  You will destroy data from @mysite.local:/home/user/www/mysite/%files and replace with data from @carloscamara.live:/home/user/www/mysite/%files
  Do you really want to continue? (y/n): y
  The source and destination cannot both be remote.
  rsync error: syntax or usage error (code 1) at main.c(1166) [Receiver=3.0.8]


This is mysite.aliases.drushrc.php content:

$aliases['local'] = array(
    'uri'  =&gt; 'localhost/mysite',    
    'root' =&gt; '/home/user/www/mysite',
    'path-aliases' =&gt; array(
      '%files' =&gt; 'sites/default/files',
     ),
     'command-specific' =&gt; array (
       'sql-sync' =&gt; array (
         'no-cache' =&gt; TRUE,
       ),

$aliases['live'] = array(
    'uri' =&gt; 'mysite.com',
    'root' =&gt; '/home/user/mysite';
    'remote-machine' =&gt; 'mysite.com';
    'remote-user' =&gt; 'myusername',
    'remote-host' =&gt; 'mysite.com',
    'path-aliases' =&gt; array(
      '%files' =&gt; '/home/myusername/mysite.com/sites/default/files',
     ),
  );
To set up to do a drush rsync or drush sql-sync to a remote machine, set up aliases for both sites on the local machine.  The alias for the local site should be as you have shown in your question.  For the remote machine:

$aliases['stage'] = array(
    'uri'  =&gt; 'staging.mysite.com',    
    'root' =&gt; '/home/user/www/mysite',
    'remote-host' =&gt; 'stagingfqdn.myisp.com',
    'remote-user' =&gt; 'wwwadmin',
  );


'remote-machine' should be the fully qualified domain name of the machine that hosts the remote site.  This may or may not be the same as the 'uri' parameter.  You might need to edit /etc/hosts, but only if the remote machine is not resolvable in DNS (unusual).  The 'remote-user' should be the name of the user that owns the files at the Drupal root; usually this is not the user that the web server runs as.

It sometimes makes sense to sql-sync from local to remote -- for example, when bringing a site live for the first time.  Usually, though, you are going to want to rsync your code from local to remote (or check it out from a vcs), and sql-sync your database from remote to local (and never the reverse).  This will insure that you do not overwrite user-generated content. See the features module for one common solution for pushing configuration to the remote machine via copying files.

Edit: Made a typo: said 'remote-machine', but it should have been 'remote-host'.  Corrected above.

Edit 2: Originally I said "rsync your files from local to remote (and never the reverse), but I meant code.  Corrected above.  It is, of course, reasonable and customary to rsync %files from remote to local, as shown in your updated question.