I'm running Drush 10 and have set up site aliases for my local and the remote Drupal site. When I run the following command for my local alias:

drush @local dd

This returns:


But when I run the same command for my remote alias:

drush @remote dd 

This returns:


Connection to "remote" closed

Why is the output different? Is there any chance to avoid the "connection closed" message?

  • I guess Drush opens a SSH connection to the remote, performs the command, returns you the output of that command and then tells you that it closed the SSH connection again, no? What happens with other commands, like let's say cache:rebuild? Is it the same?
    – leymannx
    Jul 30 '20 at 19:48
  • Ah it seems this is coming from an SSH option that Drush adds. Run drush -v @remote dd to get more verbose output and you'll see what SSH command it actually performs. Then see superuser.com/a/457344/219801. But I have no idea how to prevent this at that point. Can you pass SSH options to Drush site aliases? I don't think so.
    – leymannx
    Jul 30 '20 at 20:05
  • Wow, just found the --ssh-options. Okay, what happens when you run drush --ssh-options="-o LogLevel=QUIET" @remote dd? Or when you add LogLevel QUIET to your ~/.ssh/config?
    – leymannx
    Jul 30 '20 at 20:25

--ssh-options="-o LogLevel=QUIET" suppresses the SSH message but still produces a blank line. Although I couldn't put this into the command line I was able to add this to the self.site.yml file.

  options: -i /cert.pem -o LogLevel=QUIET
  • It also works to add the same to ~/.drush/drush.yml which fixes it for all sites
    – AdamS
    Jan 6 at 11:35

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.