Here’s how I enabled SSH on my Synology DiskStation. This allows me to access it remotely and rsync makes it a suitable backup location.
Step 1: Enable SSH
Via the web interface, go to Control Panel – Terminal & SNMP and check Enable SSH Service
Step 2: Add a user
Control Panel – User – Create.
Step 3: Grant SSH access
SSH as root and edit the passwd file
vi /etc/passwd
Make sure the user has a shell instead of /sbin/nologin
... mynewuser:x:1028:100::/var/services/homes/mynewuser:/bin/sh ...
Step 4: Enable the User Home Service
Control Panel – User – Advanced – Check Enable user home service
Otherwise, you’ll see something like this:
Could not chdir to home directory /var/services/homes/mynewuser: No such file or directory
Step 5: Disable root login
vi /etc/ssh/sshd_config
... #LoginGraceTime 2m PermitRootLogin no #StrictModes yes #MaxAuthTries 6 ...
Note that in order to gain root access once this is done, either enable telnet or install sudo. You can no longer SSH as root, and mynewuser is not allowed to su.
Step 6: Backup stuff using rsync
/usr/bin/rsync -a -e /home/erik/importantfiles/ mynewuser@synology.diskstation:/volume1/importantfiles
An absolute path is required, otherwise you’ll start seeing a write error:
ERROR: module is read only
When using DSM 5.1, there’s also an issue with permissions to the rsync binary.
Permission denied, please try again.
Make sure rsync is enabled, go to Control Panel – File Services – rsync and tick “Enable rsync service”. or explicitly defining the rsync path might help:
/usr/bin/rsync --rsync-path=/usr/syno/bin/rsync -a -e /home/erik/importantfiles/ mynewuser@synology.diskstation:/volume1/importantfiles