Using drush and aliases.drushrc.php with non-standard SSH-Port

Drupal Drush aliases.drushrc.php for setting SSH remote port

Today I'd like to give you a little hint how to a execute a remote SSH drush command successfully for a connection defined in aliases.drushrc.php when the SSH port differs from default "22". This is for example the case on Hetzner Hosting.

In my case I set the "remote-port" option, but with no success:

  1. $aliases['live'] = array(
  2.   'remote-host' => '...',
  3.   'remote-user' => 'my-user',
  4.   'remote-port' => 222,
  5. );

I always received the following error when using drush core-rsync:
exec request failed on channel 0

Finally I found the trick here to set the "ssh-options"-parameter to set the port:

  1. $aliases['live'] = array(
  2.   'remote-host' => '...',
  3.   'remote-user' => 'my-user',
  4.   'ssh-options' => '-p 222',
  5. );

That worked great :)

The following issues are related to this:

Please leave a comment if this post was helpful for you.


Perfect. Thanks for blogging

Perfect. Thanks for blogging about this! Custom client server with non-default port and I hate not using drush Wink

voila!!just what i needed

voila!!just what i needed short and informative!!thanks

Thank you, just what I

Thank you, just what I needed!