scp -3 [email protected]:prod/backups/prod-backup.sql.gz [email protected]:test/import/scp -3 [email protected]:/shared/private-files/example.txt [email protected]:/shared/private-files/As an alternative, you can use SSH with agent forwarding to directly copy files from one environment to another. With agent forwarding, the commands that you run on one infrastructure will use the same credentials to access the other, and you do not need to put a private key in either environment.
The following example assumes that you want to copy a database backup from your Production environment to your Staging environment:
Run the following command to verify that the appropriate key is loaded into your local SSH Agent:
ssh-add -lIf the command does not return any identity, you must add the key with ssh-add to allow the agent forwarding.
Connect to your Staging environment by using SSH with the -A parameter to allow agent forwarding:
ssh -A [email protected]Use rsync to copy the database backup from Production to Staging:
rsync [source server]:[backup path] [destination path]For example:
rsync --progress [email protected]:prod/backups/prod-backup.sql.gz test/import/This copies the file prod/backups/prod-backup.sql.gz on the infrastructure for the Production environment to the test/import directory of the current (Staging) infrastructure.
To copy a single multisite’s set of files, use the rsync command with the --recursive parameter in a command similar to the following:
rsync --progress --recursive [email protected]:prod/sites/othersite/files/ test/sites/othersite/files/You can complete this all in one step by passing the entire rsync command as the arguments to the SSH command:
ssh -A [email protected] "rsync --progress --recursive [email protected]:prod/sites/othersite/files/ test/sites/othersite/files/"If this content did not answer your questions, try searching or contacting our support team for further assistance.
scp -3 [email protected]:prod/backups/prod-backup.sql.gz [email protected]:test/import/scp -3 [email protected]:/shared/private-files/example.txt [email protected]:/shared/private-files/As an alternative, you can use SSH with agent forwarding to directly copy files from one environment to another. With agent forwarding, the commands that you run on one infrastructure will use the same credentials to access the other, and you do not need to put a private key in either environment.
The following example assumes that you want to copy a database backup from your Production environment to your Staging environment:
Run the following command to verify that the appropriate key is loaded into your local SSH Agent:
ssh-add -lIf the command does not return any identity, you must add the key with ssh-add to allow the agent forwarding.
Connect to your Staging environment by using SSH with the -A parameter to allow agent forwarding:
ssh -A [email protected]Use rsync to copy the database backup from Production to Staging:
rsync [source server]:[backup path] [destination path]For example:
rsync --progress [email protected]:prod/backups/prod-backup.sql.gz test/import/This copies the file prod/backups/prod-backup.sql.gz on the infrastructure for the Production environment to the test/import directory of the current (Staging) infrastructure.
To copy a single multisite’s set of files, use the rsync command with the --recursive parameter in a command similar to the following:
rsync --progress --recursive [email protected]:prod/sites/othersite/files/ test/sites/othersite/files/You can complete this all in one step by passing the entire rsync command as the arguments to the SSH command:
ssh -A [email protected] "rsync --progress --recursive [email protected]:prod/sites/othersite/files/ test/sites/othersite/files/"If this content did not answer your questions, try searching or contacting our support team for further assistance.