2

I am trying to get database syncing with drush going. I installed drush on my webserver, but I only have the permission to run it with bash or sh before drush. (So with ./drush I get permission denied)

It seems that my local drush calls the remote drush without bash or sh, so I get permission denied when I try drush status for my @bla.remote.

Is there a way to tell drush to use these commands or can you think of another way to bypass this problem?

Could I write an alias somewhere into drush?

  • Oh, you might just need to chmod +x your drush script -- but if that does not work, I describe how you can provide your own Drush wrapper below. – greg_1_anderson Sep 10 '15 at 18:30
0

You will need to do something like this:

$aliases['myremotesite'] = array (
  'remote-host' => 'isp.example.com',
  'remote-user' => 'www-admin',
  'root' => '/srv/www/example.com/drupal',
  'uri' => 'http://example.com',
  'path-aliases' => array(
    '%drush-script' => '/home/www-admin/bin/my-drush',
  ),
);

Customize URIs, paths and sitenames to suit. Then, create a 'bin' directory in your $HOME (if you don't already have one), and make yourself a 'my-drush' script like this:

#!/bin/bash

bash drush $@

Once we commit https://github.com/drush-ops/drush/pull/1595, you will be able to simplify the above by copying the drush.wrapper script to your remote site's Drupal root, and prefixing its call to the Drush launcher with bash. That PR is close, but it's also Drush 8 only, so you might prefer making your own my-drush script, as shown above.

  • Hi, thanks for your answer. Unfortunately with this script I have the same problem as with drush. I can only run it with bash. I've already tried messing with the permissions, but I can't fix it this way. – mtthias Sep 10 '15 at 19:15
  • Well, while you could set '%drush-script' => 'bash' in your alias, there is no way for you to add drush as its new first parameter, so I think you're out of luck here. Ask your webserver support staff if they can allow you to run scripts without bash, or if they have some other way that will allow you to set the executable bit successfully (SE Linux issue, maybe?). – greg_1_anderson Sep 10 '15 at 23:58
  • I just contacted them and they wont give me the permissions :( Could I maybe alter my local drush in any way for this to work? Cause there I can do what I want. – mtthias Sep 11 '15 at 12:45
  • Your hosting provider has disabled executable scripts, so you cannot solve your problem with scripts! The best solution would be to switch to a more reasonable provider. The only recourse you have currently is to write the above bash drush $@ as a short "C" program, and point '%drush-script' to that. – greg_1_anderson Sep 11 '15 at 15:48

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.