0

I've been struggling with a drush-related issue for awhile now and have more 'evidence' to write about. So here's what's going on: I'm trying to drush INTO two different servers (one on bluehost, another on rochen) and I get the same errors when I use my local drush on my computer to drush into either server. The error is Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).

I get this error trying to drush @rochen status OR drush @bluehost status (the @name being the name of my alias files rochen.aliases.drushrc.php and bluehost.aliases.drushrc.php respectively.

I have installed drush on both servers already and can do drush commands on both using putty terminal.

I can drush just fine into Pantheon and any local sites I setup. I can also SSH into both rochen and bluehost just fine using Putty (I'm on Windows).

If I use drush --root=/home/username/public_html --uri=websiteurl status it returns results...which is weird because I thought that command was supposed to be the same as doing drush @alias status which gives the error.

So I think maybe I have something wrong with my alias. See my alias file (I've confirmed the root is OK with my sysadmin):

<?php
$aliases['bluehost'] = array(
    'root' => '/home/username/public_html',
    'uri' => 'http://url.com',
    'remote-host' => 'url.com',
    'remote-user' => 'username',
);

// the following line is something I've tried to add in hopes it would help but it doesnt
//$options['ssh-options'] = '-o PasswordAuthentication=no -i C:/keys/ppkfile.ppk';

SOLUTION:

I fixed the permission denied error, the stdin: not a tty error, AND the bash: drush: command not found errors all in one fell swoop. See here: http://learningwithsage.com/wp/?p=236.

1 Answer 1

0

Try this first:

ssh-copy-id [email protected]

Make sure that the username and url match what is in your alias, of course. The "Permission denied" error is complaining that the remote site does not have your public key stored in its "authorized keys" file. ssh-copy-id will fix this for you.

If you are on a Mac, you can get ssh-copy-id from here:

https://github.com/beautifulcode/ssh-copy-id-for-OSX

It should be bundled with openssh on linux.

6
  • Thanks, but I'm using Windows. Also, the public/private key pair was created ON the server(s) in question and I downloaded the private key to my computer. So I don't see how the server could complain it doesn't have the public key as I don't even have the public key.
    – Sage
    Jan 22, 2015 at 9:22
  • The only place that the server will look for public keys is in the "authorized keys" file in the .ssh folder of the user you are trying to connect as. The easiest way to insure that everything is set up correctly is to generate the public and private keys on the client, and then run ssh-copy-id [email protected]. The ssh-copy-id utility will copy your public key into the correct authorized keys file on the server. You will need to be able to authenticate with a password for this to work. Jan 22, 2015 at 17:03
  • I believe you. Just to be clear though, you're saying to create the key pairs on my computer and then run that command ssh-copy-id from...putty or something after I've already accessed the server with SSH? I presume the command will know to look for my pub. key in my .ssh folder and put it into the one on the server. That seems pretty great. Just as an FYI: I did look in the .ssh folder on my server and it has all the keys I setup in there already.
    – Sage
    Jan 22, 2015 at 19:38
  • Sorry, my mistake; I don't think that ssh-copy-id is available on Windows. Not sure, did not search for it. Anyway, if you have your public key on the server in ~/.ssh/id_rsa.pub, then run cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys on the server. Make sure that the authorized_keys file is chmod 600; ssh checks for this, and ignores the file if the permissions are too weak. Once you do that, then it should work. It does not work now because ssh does not look in ~/.ssh/id_rsa.pub for your public key -- it only looks in ~/.ssh/authorized_keys. Jan 23, 2015 at 6:51
  • I've been working hard at this. I used your technique and the public key errors went away. Then I was getting an stdin error but managed to get rid of that too. Now I'm left with bash: drush: command not found. I put a path to drush in .bashrc. I tried export PATH=$PATH:~/path (I found the path in bash_profile). But that didn't work, the only thing that gives output other than the error is PATH=$PATH: ~/path (note the space after the colon). But at the end of listing all the drush commands when i run it it still says bash: drush: command not found...any idea why?
    – Sage
    Jan 26, 2015 at 8:21

Your Answer

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

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