Information for: DEVELOPERS   PARTNERS

Accessing system files

This information on this page describes how you can view and access various system files in your Acquia Cloud environments.

You can download your database backups using the Databases page in the Acquia Cloud interface, as described in Backing up your application: Database backups. You can download your logs using the Logs page, as described in About Acquia Cloud logging.

You can also access and transfer your files using SFTP, scp, rsync, or SSH; connect using the full DNS name and not your application URL host name. Also, sign in as your default (Unix) username even if you assign the SSH key to a different username.

File locations

You can access the file paths and directories for each of your environments at the following locations:

Note

When using the paths listed in the following table, be sure to replace these variables in the paths with values that describe your application:

  • [site] - Your application’s site name
  • [env] - The alias for the environment, typically one of the following: dev (Development), test (Staging), or prod (Production)
  • [sitedir] - Your application’s folder in the [docroot]/sites directory. For more information, see About Drupal multisite installations
  • [servername] - The server associated with your application, which you can find on the Servers page for the environment
  • [logname] - The log file that you want to access (for a list of available log files, see About Acquia Cloud logging)
Area Path Descriptions
Public files /mnt/files/[site].[ env]/files Root files directory for public downloads
Public files (multisite) /mnt/files/[site].[env]/sites/[sitedir]/files Multisite files directory for public downloads for your application
Private files /mnt/files/[site].[env]/files-private Root files directory for private downloads — instructions to change the default path
Private files (multisite) /mnt/files/[site].[env]/sites/[sitedir]/files-private Multisite files directory for private downloads for your application — instructions to change the default path
Temporary files /mnt/tmp/[site].[env] Ephemeral data storage, per server, for temporary files generated by Drupal (for multi-server installations, see Correcting broken file uploads)
Backups /mnt/files/[site].[env]/backups Downloadable daily and on-demand database backups
Import /mnt/files/[site].[env]/import Files you upload to be imported into your application
Logs /var/log/sites/[site].[env]/logs/[server name]/[logname].log Server log files (for more information, see About Acquia Cloud logging)
Live Development code repository /mnt/gfs/[site].[env]/www Code repository for your Live Development (for more information, see Using Live Development mode to change code on your server)

Modifying the private files directory

Note

Acquia Cloud Site Factory subscribers should instead use the process described at Private files in Acquia Cloud Site Factory.

You can change the private files directory by setting the file_private_path variable in your application’s settings.php file. Although the directory may be set to one of the Acquia Cloud default locations described in the previous table, it may also be set to /mnt/files/[site].[env]/sites/default/files-private (where [site] is the site name, [env] is the environment name, and [sitedir] is the directory for the multisite).

If you want to use a different location for private files, save the file system form for all websites in all environments which, when processed, will create the correct directories. To do this, complete the following steps:

  1. Add the following code to your website’s settings.php file to detect both the Acquia environment and the current Drupal multisite:

    • Drupal 7
    if (isset($_ENV['AH_SITE_ENVIRONMENT'])) {
       $files_private_conf_path = conf_path();
          $conf['file_private_path'] = '/mnt/files/' . $_ENV['AH_SITE_GROUP']
           . '.' . $_ENV['AH_SITE_ENVIRONMENT'] . '/' . $files_private_conf_pah .
          '/files-private';
      } else {
         $conf['file_private_path'] = '{PATH}';
       }
    
    • Drupal 8
    if (isset($_ENV['AH_SITE_ENVIRONMENT'])) {
    $settings['file_private_path'] = '/mnt/files/' . $_ENV['AH_SITE_GROUP'] .
     '.' . $_ENV['AH_SITE_ENVIRONMENT'] . '/' . $site_path . '/files-private';
    } else {
    $settings['file_private_path'] = '{PATH}';
     }
    

    where {PATH} is the path for the local server’s private files directory. The code allows for a non-Acquia private files location to be set for working on a local server’s copy of the website.

  2. Save your settings.php file changes.

  3. Sign in to your Drupal website as an administrator.

  4. Navigate to Configuration > Media > File system (http://[site_URL]/admin/config/media/file-system).

  5. Click Save.

The path for your private files directory can be found on this form in the text area under Private file system path. Acquia Cloud users can also set their private file directory to ../acquia-files/files-private in the Drupal UI. This setting will propagate across all their environments.

The private files directory is now saved and will persist unless deleted. The act of saving a private files directory also creates an .htaccess file containing the command Deny from all. That command prevents the serving of files from the private directory.

Once the private file system path is saved, it can then be utilized by fields. For example, you could add a file field to the Articles content type. As you configure this field, you will see that you (and other website administrators) can choose the file’s Upload destination by selecting either Public files or Private files. Files uploaded to this field are stored in your database’s files_managed table with the private: protocol, instead of the public: protocol.

You can control access to files uploaded through a file field by clearing the Display check box next to the file before publishing the piece of content to which the file is attached. Because the file will not display, users won’t be able to click it. They also won’t be able to navigate directly to any files in the private directory.

For a more detailed level of access to private files, it may be necessary to write custom modules that interact with the private file system.