Information for: DEVELOPERS   PARTNERS

Accessing system files

The 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 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 the sftp, scp, rsync, or ssh commands. You must connect using the full DNS name and not your application URL host name, and 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, replace the variables in the paths with values describing 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 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 for importing 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 must 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 set a different location, 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 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}';
     }
    
    • 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}';
       }
    

    where {PATH} is the path for the local server’s private files directory. The code allows you to set a non-Acquia private files location 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.

You can find the path for your private files directory 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 Drupal. This setting will propagate across all their environments.

After you save the private files directory, it will persist until you delete it. Saving a private files directory creates an .htaccess file containing the command Deny from all, which prevents the serving of files from the private directory.

After you save the private file system path, fields in Drupal can use it. For example, you can add a file field to the Articles content type. As you configure the file field, you 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 the file is attached to. Because the file will not display, users cannot click it, nor can they navigate directly to any files in the private directory.

For a more detailed level of access to private files, you can write custom modules to interact with Drupal’s private file system.