Synology scp commands

Synology scp command

Synology scp command via the terminal explains the steps to secure copy a folder to another NAS folder via the scp command. The scp command is executed in a terminal session that's why SSH must be enabled on the Synology NAS. Be careful running the terminal commands because files and folders can be deleted, running the commands is at your own risk. 


Synology scp command

Synology scp command terminal access

You have to make sure that SSH is enabled on the Synology NAS. This can be done from the control panel under Terminal & SNMP. For Windows you can use PuTTY to connect via SSH.

Terminal command:

ssh <admin user>@server

sudo -i

Identify both folders:

Choose which folder on the source Synology NAS you want to copy to the other Synology NAS server which will be the destination. If the destination folder doesn't exists you can create it before the copy.

Synology scp command

Let me start by saying to be careful how you proceed with the following commands because they will overwrite and delete files and folder!  So test first and check if the command is doing as expected.

Run the following scp command at your own risk and first test before usage!!!!

Name Source Synology NAS server: server01

Name Destination Synology NAS server: server02

Shared folder on server01: test test

Shared folder on server02: test test

start terminal session on server02:

Terminal command:

ssh <admin user>@server01

sudo -i

command is run from server01:

Assumed volume1

Purpose: make source shared folder the same on the destination NAS.

Secure copy files/folders within the source shared folder to the destination folder. Also copy hidden files.

Running the Synology scp command

Run the following scp command at your own risk and first test before usage!!!!

cd /volume1


scp -rp  test\ test/.  <admin user>@server02:"'/volume1/test test/'"

-r      Recursively copy entire directories. Note that scp follows symbolic links encountered in the tree traversal

-p     Preserves modification times, access times, and modes from the original file.

.       Will copy also hidden files.