I have the following in my aliases.drushrc.php file --

$aliases['prod'] = array(
    'uri' => 'foo.com',
    'root' => '/var/www/foo/htdocs',
    'remote-host' => '123.456.78.90',
    'remote-user' => 'bob',
    'databases' => 
      array (
        'default' => 
        array (
          'default' => 
          array (
            'driver' => 'mysql',
            'username' => 'foo',
            'password' => 'bar',
            'port' => '',
            'host' => 'localhost',
            'database' => 'foodb',
    'shell-aliases' => array (
        'dump' => '!drush sql-dump --gzip --ordered-dump',

When I run drush @prod dump it attempts to connect to 'remote-host'. If I comment out 'remote-host' it dumps just as expected. I do need this value though for other functions such as sql-rsync.

I could create a new alias just for dumping but this seems a little excessive.

Any ideas?

1 Answer 1


Drush decides whether a site is local or remote via the function drush_is_local_host. Make up a domain name for your system, such as foo.local, and make an entry for it in /etc/hosts (123.456.78.90 foo.local). Next, make sure that /etc/hostname also contains foo.local, and confirm this by running hostname -f. If you do all of this correctly, then you can set 'remote-host' => 'foo.local', and Drush will still treat it like localhost for commands such as sql-sync.

  • This doesn't solve the problem of Drush attempting to SSH into 'remote-host' though. Aug 30, 2012 at 13:27
  • It does on my system. Check the output of hostname -f, and make sure that you change the value of 'remote-host' to match it exactly. Test via `drush ev 'var_export(drush_is_local_host("foo.local"));', where "foo.local" is the value you put into 'remote-host'. If this matches hostname -f exactly, then drush_is_local_host should return 'true', and sql-sync should do a local dump instead of a remote ssh + dump. Aug 30, 2012 at 13:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.