remote import creates an ssh connection based on your local username, would it be possible to set this username based on the remote end's requirements instead?

With Aegir running locally on my OS X machine it uses the following:

Running: ssh -o PasswordAuthentication=no 'brian'@'host01.hostname.com' 'drush @hostmaster '\''status'\'' --backend 2>&1' 2>&1

which should instead be:

Running: ssh -o PasswordAuthentication=no 'aegir'@'host01.hostname.com' 'drush @hostmaster '\''status'\'' --backend 2>&1' 2>&1
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Steven Jones’s picture

This is actually a provision bug: #1504120: Script user of remote servers is ignored

Steven Jones’s picture

Title: Ability to entere different username for remote connections? » Ability to enter different username for remote connections?
Status: Active » Postponed (maintainer needs more info)

Once that provision issue is fixed, we should present an option in the UI to change the script user on the remote server.

Steven Jones’s picture

Status: Postponed (maintainer needs more info) » Active

So I fixed the upstream bug, so we should be able to support this in Aegir 1.9 and above.

mxmilkiib’s picture

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

This would be handy for moving from a Barracuda to an Octopus install.

Might it be possible to add a field for a non-standard SSH port also?

helmo’s picture

Project: Remote import - Provision » Aegir Hosting Remote Import
Version: 6.x-1.x-dev » 7.x-3.x-dev
Issue summary: View changes

moving....

colan’s picture

Title: Ability to enter different username for remote connections? » Allow for custom usernames and ports on remote connections

Incorporating #4.

gval’s picture

Hi,
I'm using some servers with differents usernames (o1, o2, dev1,...),
so i have made a patch to choose a custom username on server config page.

See attached file.

helmo’s picture

Thanks for looking into this.

+++ b/drush/Provision/Service/remote/import/hostmaster.php
@@ -121,7 +129,14 @@ class Provision_Service_remote_import_hostmaster extends Provision_Service_remot
+    if (isset($this->server->remote_user)) {

These should probably be empty() instead of isset(). When you clear the new field it would otherwise use an empty string as username.

gval’s picture

FileSize
4.43 KB

Yes, you're right.

I've replaced "isset" by "!empty" to avoid an empty string as username.

colan’s picture

Status: Active » Needs review
colan’s picture

Status: Needs review » Needs work

I haven't tested this, but I took a quick look at the code. Yes, thanks for working on this.

+++ b/hosting_remote_import.service.inc
@@ -25,6 +25,61 @@ class hostingService_remote_import_hostmaster extends hostingService_remote_impo
+  ¶
...
+  ¶
+  ¶
...
+  ¶
...
+  ¶
...
+  ¶
...
+  ¶
...
+  ¶

Extra whitespace is appearing on these blank lines. (8 lines from 29 to 84.)

+++ b/hosting_remote_import.service.inc
@@ -25,6 +25,61 @@ class hostingService_remote_import_hostmaster extends hostingService_remote_impo
+      );

Bad indentation.

gval’s picture

FileSize
4.07 KB

New patch (v3.10)

colan’s picture

Status: Needs work » Needs review
helmo’s picture

Apart from the two trivial updates below it looks sane, but I haven't got time to test it properly.
@colan, can we get it rtbc by Thursday? Then I can include it it 3.11

  1. +++ b/hosting_remote_import.service.inc
    @@ -26,5 +26,59 @@ class hostingService_remote_import_hostmaster extends hostingService_remote_impo
    +  ¶
    

    whitespace bug

  2. +++ b/hosting_remote_import.service.inc
    @@ -26,5 +26,59 @@ class hostingService_remote_import_hostmaster extends hostingService_remote_impo
    +    drush_log("context_options " . print_r($task,1));
    

    debug?

colan’s picture

If there's a new patch available shortly, I should be able to test it by then (at least ensuring that it doesn't break anything).

  • colan committed 450e313 on 7.x-3.x authored by Valery Gouleau
    Issue #1503712 by Valery Gouleau: Added support for custom usernames.
    
colan’s picture

Status: Needs review » Active
FileSize
3.99 KB

Fixed coding standards violations. See interdiff for details.

As this doesn't appear to break existing functionality, I committed it.

Set status back so we can work on adding support for custom ports (or any follow-up commits if the new functionality needs tweaking).

cvining’s picture

Custom ports would be handy, and a bit more secure. For me, remote imports is a very helpful (when migrating to a new server, for example) but not every day. So, I just switch my SSH server back to port 22 for the imports and return to a custom port when I'm done.

Thanks for all the fish!