I know it's not equivalent, but I can drush rsync @local @remote but not drush @remote status -v. So my ssh keys are in place, I'm on the right port etc.

I get:

Loaded alias @remote from file /Volumes/Users/blah/.drush/aliases.drushrc.php
Begin redispatch via drush_invoke_process().
Calling proc_open(ssh -p 22009 BLAH@xxx.xxx.xxx.xxx 'env COLUMNS=238 drush  --verbose --root=/home/REMOTE/d7 --uri=d7.REMOTE.co.uk  core-status 2>&1' 2>&1);

env: drush: Permission denied

What do I need to set on @remote to make it work? Drush is installed there (same version) and works happily.

Is there are Drush error log or will I need to get the hosting company to have a look through logs?

Here is my alias:

$aliases['REMOTE'] = array(
   'root' => '/home/REMOTE/SUBDIRECTORY',
   'uri' => 'http://REMOTE.co.uk',
   'remote-host' => 'xx.xx.xx.xx',
   'ssh-options' => '-p 22009',
   'remote-user' => 'SSH_USER',
   'path-aliases' =>
   array (
      '%drush' => '/home/REMOTE/.composer/vendor/drush/drush',
      '%site' => 'sites/default/',
      '%dump-dir' => '/home/REMOTE/drush.dbdumps',
   'databases' =>
   array (
      'default' =>
      array (
         'default' =>
         array (
            'database' => 'xxx',
            'username' => 'xxx',
            'password' => 'xxx',
            'host' => 'localhost',
            'port' => '',
            'driver' => 'mysql',
            'prefix' => '',

The first thing to do is to ensure that the 'remote-user' in your site alias is the same user that you use when you log in to the site.

The next thing to check is whether or not drush is on your $PATH on the remote site. You have probably set this up explicitly in a .bashrc file, since it is working when you log in locally. However, often, .bashrc files exit early when called in non-interactive mode, as Drush does.

Perhaps the easiest way to get around this is to figure out what the correct full path to the drush script is, and set '%drush-script' in the 'path-aliases' of your site alias to point at the correct executable. See example.aliases.drushrc.php.

UPDATE: Use '%drush-script', not '%drush'.

'remote-user' is the user that Drush will use to log in via ssh. It should be a user that has permission to use Drush. Some people use the webserver user for this, but if you have a separate web admin user, that would be a preferable choice.

  • I should have said I have a site alias (now added to the question) which I based on the output of drush site-alias --with-db --show-passwords --with-optional @self
    – bloke_zero
    Oct 27 '15 at 9:49
  • I'm a bit confused by the remote-user thing, that is the user I use to connect via SSH, should that be the same name as the Drupal admin user? Thanks.
    – bloke_zero
    Oct 27 '15 at 9:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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