Start of Main Content

Having trouble connecting to the new Acquia Cloud Next environment with Secure Shell (SSH) or Drush to perform your Drupal development? The architecture upgrade from Acquia Cloud to Acquia Cloud Next has changed how you need to use advanced tools to interact with these environments. 

You may have tried to SSH into a server or use a Drupal Drush command to run a task only to be greeted with an error like this in the command line: 

[email protected]: Permission denied (publickey). 

This has to do with recent updates to OpenSSH, the software that powers the underlying secure connection. Don’t worry, these tools still work. There’s one option you need to add to your commands to get up and running again. Here are three ways you can get connected with SSH or Drush to Acquia Cloud Next and get back to development nirvana. 

Also having trouble connecting to your database on Acquia Cloud Next?

We figured out how to resolve issues that Acquia Cloud Next creates with connecting Acquia Cloud databases to JDBC driver-based database development tools and wrote about it to help you.

Edit Your SSH Command with an Option 

The first thing you can do is pass an option along with any SSH command to tell the connection to accept ssh-rsa public keys (the reason you are getting the error above). It looks like this:  

ssh -t -o PubkeyAcceptedAlgorithms=+ssh-rsa
[email protected]

This is the fastest way to prove why you’re receiving the previously mentioned error. However, it is a lot to have to type out in every command. So, we have a way that adds it to all outgoing commands to Acquia. 

Edit Your SSH Configuration File 

You can edit your local SSH configuration file (typically found at ~/.ssh/config) and add the following:  

Host *.ssh.prod.acquia-sites.com
PubkeyAcceptedAlgorithms +ssh-rsa  

This tells any SSH connection that when connecting to any hostname that matches *.ssh.prod.acquia-sites.com to accept ssh-rsa type public keys. Once you add this and save, restart your terminal session and you will be good to go. In this method, you don’t have to append every SSH command like in the first example.  

If you’re working in Docker containers and/or in a team-based setting, the third and best option is to edit your Drush alias file in your project.  

Edit Your Drush Alias File

Your best bet is to add the SSH option to your Drush alias file in the project. This will fix the issue permanently for you and your team as soon as they receive the updated file from the Git repository. Again, you’re passing along the same SSH option, which will fix Drush. For every site alias in our Drush aliases file, you need to add this:  

 ssh:  
    options: '-o PubkeyAcceptedAlgorithms=+ssh-rsa'

 Here is a complete example of an alias for the ‘dev’ environment:  

dev:  
  root: /var/www/html/docroot  
  ac-site: mysite  
  ac-env: dev  
  ac-realm: prod  
  uri: mysite.prod.acquia-sites.com  
  host: mysite.ssh.prod.acquia-sites.com  
  user: mysite.dev  
  ssh:  
    options: '-o PubkeyAcceptedAlgorithms=+ssh-rsa'  
  paths:  
    drush-script: drush9  

This ensures that any Drush command executed will add the SSH option on. Don’t forget to repeat this step for the test and prod aliases. 

Now that you have this fix in place, you can use Drush to interact with your cloud environments or SSH into them using drush @alias ssh to log in to them via SSH.  

We hope this helps you resolve your issue using Drush on Acquia Cloud Next! Having trouble connecting to your database on Acquia Cloud Next? Be sure to check out our other post on how to connect a database client to Acquia Cloud Next to see how to get connected! And if you have additional questions about Acquia and Drupal, contact us.


Published:

Latest Ideas

Take advantage of our expertise with your next project.