---
title: "Transferring files to a different docroot"
date: "2024-02-14T06:18:38+00:00"
summary: "Learn how to securely transfer files between different docroots using rsync. Follow our step-by-step guide for setting up SSH keys, managing permissions, and executing file transfers across Acquia Cloud environments."
image:
type: "page"
url: "/acquia-cloud-platform/transferring-files-different-docroot"
id: "5e129e1c-f26b-4326-be86-7d8176981992"
---

In various circumstances, users will want to [copy files to a different environment](../transfer-files.html). Other applications may share a single infrastructure in standalone or multisite configurations, which can require several [docroot](/definitions/docroot) directories on the same infrastructure. You can also use the `rsync` command to complete file transfers in this situation.

To transfer files to a different, local application:

1.  [Create a private key](/acquia-cloud-platform/manage-apps/command-line/ssh/getting-started/generate) on your local computer.
2.  [Add the public key](/acquia-cloud-platform/manage-apps/command-line/ssh/getting-started/add-key) to an account that has team lead permissions on the source infrastructure.
3.  Copy the private key to the `.ssh` directory in the destination directory.
4.  Set the `.ssh` directory permissions by using the following command:
    
    `chmod 700 .ssh`
    
5.  Use the following command to set the private key file permissions:
    
    `chmod 400`
    
6.  Run your rsync command. For example, the following is an rsync command between docroot directories on the same infrastructure:
    
        rsync -avz -e "ssh -i /home/sourcedocroot/.ssh/id_rsa_rsync"  destinationuser.dev@destinationuserdev.prod.hosting.acquia.com:/mnt/gfs/sourceenv.dev/files /mnt/gfs/destinationenv.dev/files/
    

Tunneling
---------

Setting up the SSH keys between applications is also a method to help enable SSH tunneling between infrastructure, or between your infrastructure and an external application. For more information, see [SSH tunneling for infrastructure-side applications](/acquia-cloud-platform/help/92326-ssh-tunneling-server-side-applications "SSH tunneling for server-side applications").