0

I am getting permission denied publickey password when I type

drush @prod (alias for my production site on shared bluehost.com) status

Both drush @dev (alias for my local site running on Win 7) status & drush status work fine.

Here is the output from drush @dev status executed on my Win 7 machine.

C:\Windows\system32>drush @dev status
Drupal version : 7.43
Site URI : http://bluehostclone
Database driver : mysql
Database hostname : 127.0.0.1
Database port : 33067
Database username : drupaluser
Database name : bluehostclone
Drupal bootstrap : Successful
Drupal user :
Default theme : outreach
Administration theme : seven
PHP executable : php.exe
PHP configuration : "C:\Program Files (x86)\DevDesktop\php5_5\php.ini"
PHP OS : WINNT
Drush script : C:\Program Files(x86)\DevDesktop\drush\vendor\drush\drush\drush.php
Drush version : 8.0.0
Drush temp directory : C:\Users\Sam\AppData\Local\Temp
Drush configuration : "C:\Program Files(x86)\DevDesktop\drush\vendor\drush\drush\drushrc.php"
Drush alias files : "C:\Program Files (x86)\DevDesktop\drush\vendor\drush\drush\includes/../aliases.drushrc.php" c:\users\sam\sites\devdesktop\bluehostclone\sites\all\drush/myaliases.alias.drushrc.php C:\Users\Sam\Sites\devdesktop\bluehostclone/sites/all/drush/myaliases.alias.drushrc.php
Install profile : openoutreach
Drupal root : C:\Users\Sam\Sites\devdesktop\bluehostclone
Site path : sites/default
File directory path : sites/default/files
Private file : backups
directory path
Temporary file : /tmp
directory path</code>

Output from the same command executed on production server**

columck5@columbiablooms.org [~]# drush status --full
 PHP executable         :  /ramdisk/php/54/bin/php54-cli
 PHP configuration      :  /home1/columck5/public_html/drush/php.ini
 PHP OS                 :  Linux
 Drush script           :  /home1/columck5/.composer/vendor/drush/drush/drush.p
                           hp
 Drush version          :  7.1.0
 Drush temp directory   :  /tmp
 Drush configuration    :
 Drush alias files      :
 Other paths            :</code>

aliases.drushrc.php (on Win 7 computer) Password has been blotted out.

$aliases["dev"] = array (
  'root' => 'C:\\Users\\Sam\\Sites\\devdesktop\\bluehostclone',
  'uri' => 'http://bluehostclone',
  'path-aliases' =>
  array (
    '%drush' => 'C:\\Program Files (x86)\\DevDesktop\\drush\\vendor\\drush\\drush',
    '%site' => 'sites/bluehostclone/',
  ),
  'databases' =>
  array (
    'default' =>
    array (
      'default' =>
      array (
        'driver' => 'mysql',
        'database' => 'bluehostclone',
        'username' => 'drupaluser',
        'password' => '',
        'host' => '127.0.0.1',
        'port' => 33067,
      ),
    ),
  ),
);

$aliases["prod"] = array (
  'remote-host' => 'box1278.bluehost.com',  
  'root' => '/home1/columck5',
  'uri' => 'http://columbiablooms.org',
  'path-aliases' =>
  array (
    '%drush' => './drush',
    '%site' => '/public_html',
  ),
  'databases' =>
  array (
    'default' =>
    array (
      'default' =>
      array (
        'driver' => 'mysql',
        'database' => 'columck5_dr9626',
        'username' => 'columck5',
        'password' => '***',
        'host' => 'localhost',
        'port' => '',
      ),

Output from drush @prod status -v -full --debug`

Drush preflight prepare loaded autoloader at C:\Program Files        [preflight]

(x86)\DevDesktop\drush\vendor\autoload.php [0.13 sec, 1.71 MB]
Starting Drush preflight. [0.24 sec, 1.71 MB]                        [preflight]

Loading drushrc "C:\Program Files                                    [bootstrap]

(x86)\DevDesktop\drush\vendor\drush\drush\drushrc.php" into "drush"
scope. [0.24 sec, 1.71 MB]
Cache HIT cid: 8.0.0-commandfiles-0-8cbf3598903cd4c09cf48f8bb47cae28     [debug]

[0.36 sec, 1.76 MB]
Scanning into C:\ProgramData/Drush/etc/drush for                     [sitealias]

/.*aliases\.drush(8|)rc\.php$/ [0.44 sec, 3.45 MB]
Scanning into C:\ProgramData/Drush/etc/drush for                     [sitealias]

/prod\.alias\.drush(8|)rc\.php$/ [0.44 sec, 3.45 MB]
Scanning into C:\Program Files                                       [sitealias]

(x86)\DevDesktop\drush\vendor\drush\drush\includes/.. for
/.*aliases\.drush(8|)rc\.php$/ [0.44 sec, 3.45 MB]
Scanning into C:\Program Files                                       [sitealias]

(x86)\DevDesktop\drush\vendor\drush\drush\includes/.. for
/prod\.alias\.drush(8|)rc\.php$/ [0.57 sec, 3.45 MB]
Scanning into C:\Users\Sam\Sites\devdesktop\columbiablooms-dev/.drush[sitealias]

for /.*aliases\.drush(8|)rc\.php$/ [0.71 sec, 3.45 MB]
Scanning into C:\Users\Sam\Sites\devdesktop\columbiablooms-dev/.drush[sitealias]

for /prod\.alias\.drush(8|)rc\.php$/ [0.71 sec, 3.45 MB]
Scanning into                                                        [sitealias]

C:\Users\Sam\Sites\devdesktop\columbiablooms-dev/.acquia/DevDesktop/Drush/Aliase
s
for /.*aliases\.drush(8|)rc\.php$/ [0.71 sec, 3.45 MB]
Scanning into                                                        [sitealias]

C:\Users\Sam\Sites\devdesktop\columbiablooms-dev/.acquia/DevDesktop/Drush/Aliase
s
for /prod\.alias\.drush(8|)rc\.php$/ [0.71 sec, 3.45 MB]
Loaded alias @prod from file C:\Program Files                           [notice]

(x86)\DevDesktop\drush\vendor\drush\drush\includes/../aliases.drushrc.php
[1.06 sec, 5.2 MB]
Begin redispatch via drush_invoke_process(). [1.18 sec, 5.21 MB]        [notice]

Backend invoke: ssh -o PasswordAuthentication=no box1278.bluehost.com  [command]

"drush  --debug --uri=http://columbiablooms.org --verbose --user
--root=/home1/columck5  core-status   --f 2>&1" 2>&1 [1.18 sec, 5.22
MB]
Calling proc_open(ssh -o PasswordAuthentication=no box1278.bluehost.com "drush
--debug --uri=http://columbiablooms.org --verbose --user --root=/home1/columck5
 core-status   --f 2>&1" 2>&1);
Permission denied (publickey,password).
End redispatch via drush_invoke_process(). [1.95 sec, 5.21 MB]          [notice]
`
    ),
  ),
);

I'm guessing the answer to my problem lies somewhere above, but despite lots of Google searches I'm not able to figure out what this is telling me. I am a newbie.

Update: I made the following changes.

    a. Changed root to '/home1/columck5/public_html'
    b. Changed %drush to '/home1/columck5/.composer/vendor/drush/drush'
    c. Changed %site to  'sites//'
    d. ****** All above changes on Win 7. **************
    e. Added 
    PATH=$PATH:/home1/columck5/.composer/vendor/bin
    to bashrc on remote

Drush @prod status returns nothing after these changes.

1

This is a SSH question really. You need to enable publickey login to the server. To test (without involving Drush) run

ssh -o PasswordAuthentication=no box1278.bluehost.com date

When that commands returns the date, and not an error, you can return to Drush ;-)

Your ISP probably has some info about this but basically you have to generate a SSH private-public key-pair and add the public key to the .ssh/authorized_keys on the server. Just Google it!

  • Thanks. I ran the ssh command twice as near as I can tell it worked, but when I type drush @prod status on my Win 7 machine I still get the permission denied error message. I checked the authorized_keys file. It looks good. Those are public keys right? How does my private key (on Win 7) get hooked up with my cmd prompt window where I'm running drush? Maybe it's the private key on my end that's the problem? – Sam Stamport Mar 3 '16 at 0:11
  • Did you run the ssh command in the same terminal/cmd prompt as you run Drush. If so, they should find the same private key. PS! Could you edit your question and use code tags around the output from Drush so it's easier to read. Now it looks like a mess ;-) – hansfn Mar 3 '16 at 10:08
  • I hope I cleaned up the code formatting ... I ran the ssh command 5 times on my Win 7 cmd prompt and got the same permission denied error message. I ran it using Putty on my server, bluehost, first. got any other ideas as to solve my problem? – Sam Stamport Mar 3 '16 at 23:56
  • The code formatting is better, but the output from "drush @dev status" command could be fixed too. You aren't saying anything about which software is providing ssh/php/mysql and so on. That really mattes a lot. Anyway, I suggest that you read serverfault.com/questions/194567 and then stackoverflow.com/questions/17846529 That should get you inspired. – hansfn Mar 4 '16 at 8:37
  • The links you provided are of no help and your tone of voice is harsh. I am a newbie trying to learn all the minutia of Drupal, but finding myself down this rabbit hole of SSH. I finally managed to fix it so I can login to my remote host from my Win 7 machine, but I'm still getting the permission denied error message on drush @prod status command. The video at youtube.com/watch?v=hY6pthfoNjw was helpful. – Sam Stamport Mar 6 '16 at 18:32
1

First, as noted above, you will need to check that your public key is added to the Web server. Usually, it's done locally (provided you already have a public key), by running ssh-copy-id -i ~/.ssh/id_rsa.pub [your_username@remote_host]. Once you close your CLI session and reopen, if it works, you should be able to log in without a password when entering ssh your_username@remote_host, since it's referencing your local credentials.

Then, add this to your production site alias:

ssh-options' => '-i ~/.ssh/id_rsa', ssh-options' => '-o PasswordAuthentication=yes',

Drush will now be able to connect using your stored credentials.

One other thing to check—what shell you are running locally? In looking at your output above, the debug script has the 2>&1 string in it. Because of this, it appears your Web host is running bash as its shell, but I'm not sure about your local. Presumably, if it were bash/bourne, your commands would work fine. If csh/tcsh, there is the issue that Drush only supports bash or Bourne shells. The 2>&1 is bourne/bash syntax to redirect stderr to stdout, but it’s not understood by csh/tcsh and the command fails.

You may want to run finger [your_username] in your local environment, which will show your shell. If not bash, you may look if you can change it to that, after which you should be able to run remote drush commands locally.

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.