Managing Drupal remotely with drush
In this article we're going to describe the configurations required in order to allow someone to remotely manage Drupal instances using drush aliases (on his own computer).
- You need to have SSH access to the remote server (preffered method is key based auth - to avoid password input on every command)
- You need to have Drupal instance on the remote server
- On your computer you need to have installed PHP 5.x and Drush (I preffer git checkout from https://github.com/drush-ops/drush)
- Make sure you have the proper permissions setup for your remote account. This include writing into the Drupal directory, as some commands such as module updating requires writing permissions. You do that by changing drupal directory ownership to apache group, grant apache group writing permissions to Drupal and make yourself member of the apache group.
- Create a drush alias for your server. This will contain the required information to remotely connect and manage the Drupal instance - see example below
cristiroma:.drush cristiroma$ cat osha.aliases.drushrc.php
$aliases['server.dev'] = array(
'uri' => 'dev.server.org',
'db-url' => 'mysql://user:firstname.lastname@example.org/db',
'db-allows-remote' => TRUE,
'remote-host' => 'dev.server.org',
'remote-user' => 'john',
'ssh-options' => '-o "AddressFamily inet"',
'root' => '/path/to/drupal',
'path-aliases' => array(
'%drush-script' => '/usr/bin/drush',
- Now, run drush commands on your computer by adding the alias as part of the command. For instance: drush @server.dev pm-list.