Hello,

I'm at my wits' end here after days of trying to get this to work. Trying to connect from a windows xpsp3 installation of drush 5 to a nix server.

I can ssh into my drupal installation on the remote server but when I try to enter using an alias:

>drush @remote st -d

Bootstrap to phase 0. [0.04 sec, 2.16 MB] [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drush() [0.05 sec, 2.31 MB] [bootstrap]
Load alias @remote [0.11 sec, 2.31 MB] [notice]
Cache HIT cid: [debug]
5.0-dev-commandfiles-0-d8d3967dfa51a88287b69106e9245276 [0.16 sec,
2.33 MB]
Begin redispatch via invoke process [0.26 sec, 5.13 MB] [notice]
Backend invoke: ssh -o PasswordAuthentication=no [command]
admin@test.site.com "drush --debug --root='~/public_html/test'
--uri=http://default --verbose st --invoke 2>&1" 2>&1 [0.32 sec, 5.15
MB]
executing ssh -o PasswordAuthentication=no admin@test.site.com [notice]
"drush --debug --root='~/public_html/test' --uri=http://default
--verbose st --invoke 2>&1" 2>&1 [0.36 sec, 5.15 MB]
Calling proc_open(ssh -o PasswordAuthentication=no admin@test.site.com "drush --debug --root='~/public_html/test' --uri=http://default --verbose st --
invoke 2>&1" 2>&1);

And drush just hangs there, I have to break out with CTRL-C

There is nothing in the ssh log on the server but I can see ssh handshake in wireshark.
I have tried a myriad of permutations in the root, uri alias settings.
Any idea how to debug this?

Thanks

knic

Comments

knic’s picture

Issue summary: View changes

sanitized

greg.1.anderson’s picture

Status: Active » Postponed (maintainer needs more info)

The ssh command that Drush is trying to execute is there in your logs, above. Try typing it in exactly to your shell; it should hang in the same way. Remove parameters from this ssh command until it works, &/or add some of these parameters to your working ssh command until it stops working. This will isolate, at least, the item that is causing the failure.

I have not tried Windows-to-Linux remote commands in a while, but I believe it was working last time I tried it.

knic’s picture

Thank you Greg, that was a big help. It's bombing out because of the "PasswordAuthentication=no" part. If I change that to yes and manually enter the password when prompted it gives me the drush status of the remote site.

However, it is producing the following while logging in:

Could not create directory '/home/MyWindowsUser/.ssh'.
The authenticity of host 'test.site.com (ip.ip.ip.ip)' can't be established.
RSA key fingerprint is xx:xx:xx: etc.
Are you sure you want to continue connecting (yes/no)? yes
Failed to add the host to the list of known hosts (/home/MyWindowsUser/.ssh/known_hosts).

Is it trying to create this directory locally or on the remote site?
If it's on the remote site, then I don't understand why as it's using my windows username and not the linux username that I'm connecting with from drush.

I'm a little confused with ssh on windows and I'm not really sure what drush is using to connect... For example I have putty installed, but there is also an implementation of ssh2 that came with a GIT gui called smartgit. I'm not even sure there isn't another implementation which came with cygwin. I'm presuming that drush is using putty, but I don't know how to prove that.

Anything ideas about the above?

knic

greg.1.anderson’s picture

I don't know how to ssh from Linux to Windows. In order to use PasswordAuthentication=no, you must set up a public/private key pair between the two machines. If ssh with passwords is working, there is a function in Drush extras that will push a key over to the remote machine, but I don't know if it will work with Windows. As for your problem above, Drush will connect to the remote machine using the username defined in the site alias. Make sure that your site alias has the right username in the 'remote-user' item, and make sure that /home/ThatUsername exists.

moshe weitzman’s picture

Status: Postponed (maintainer needs more info) » Fixed

Folks should know that Drush's has winrs integration. Thats native to Windows, unlike SSH. You need to enable the winrs feature on your remote server (the drush windows installer does this for you) and in your site alias for that server, specify that it has 'os' => 'Windows'. This 'os' param is documented in examples/example.aliases.drushrc.php

greg.1.anderson’s picture

It'd still be interesting to get ssh to work on Windows, though, because sql-sync currently does not work with winrs.

knic’s picture

Although this is all very interesting (!), I think you may have actually mis-read my post: I'm connecting from a windows (XP sp3) machine to a remote linux server, not a windows server.

That aside, your insightful suggestions have helped me along the way to solving my problem, so thanks very much for taking the time to reply to me.

Here is a key point for this setup in case anybody else runs in to a similar issue:

Setup:
Windows XP (SP3) box connecting through windows drush >> OpensSSH which comes with windows drush installer as far as I can work out >> remote linux server.

Problem: When trying to connect, the drush command prompt (cygwin in this case?) tries to add the remote host to the known hosts file using linux paths as follows:

Could not create directory '/home/MyWindowsUser/.ssh'.
Failed to add the host to the list of known hosts (/home/MyWindowsUser/.ssh/known_hosts).

Solution: Add a path to the windows environment PATH variables, by right clicking on My PC, selecting properties, and then environment variables. You'll need to add a path name: HOME, and then the actual path to your Windows user. What I did was go to the directory where my known_hosts file is and copied the path from the file properties dialog. It should end up like: C:\Documents and Settings\YourWindowsUsername\.ssh.

Restart Drush and that error is taken care of. Hope it helps somebody. Caused me a good bit of head scratching.

---------------------

Now back to the problem of my remote aliases hanging.

If I paste at the command prompt:
ssh admin@test.mysite.com "drush --debug --remote-user='admin' --root='~/public_html/test' --uri=http://default --verbose st --invoke 2>&1" 2>&1

...it works, well it asks me for a passphrase from putty, or mysysgit, I guess, but it works.

However, if I use an remote alias with the following settings, it produces:

$aliases['remote'] = array (
'root' => '~/public_html/test',
'uri' => 'default',
'remote-host' => 'test.mysite.com',
'remote-user' => 'admin',
'path-aliases' =>
array (
'%drush' => '/usr/local/share/drush',
'%site' => 'sites/default/',
),
);

I can only think that it must be hanging because of that passphrase which is requested when I enter manually.
Now how to get rid of that...

All the best,

knic

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Forgot to mention my os

wesleymusgrove’s picture

Version: » 8.x-6.x-dev

@knic, I'm having this exact same issue. Did you ever figure out why it was hanging at that

Calling proc_open(ssh -o PasswordAuthentication=no admin@test.site.com "drush --debug --root='~/public_html/test' --uri=http://default --verbose st --
invoke 2>&1" 2>&1);

statement?