I’ve shown you how to use rsync for a fast and reliable backup of your Mac files to your DiskStation. One draw-back is that rsync always asks for a password to access your DiskStation which makes it uncomfortable and impossible to use in scripts. See how it works without passwords, securely.
The easiest solution to that is to build a secure SSH connection using RSA keys. Here is what you need to do.
First, enable SSH in your Synology web interface. Log into your Synology from a Terminal with “ssh 192.168.x.y”.
Edit the file /etc/ssh/sshd_config using vi as following:
#RSAAuthentication yes PubkeyAuthentication yes AuthorizedKeysFile .ssh/authorized_keys
Now on your Mac we need to create the key files using the following commands:
ssh-keygen -t rsa
Always respond by pressing enter, so the key files are store in ~/.ssh directory without a separate password. The public key in the file id_rsa.pub needs to be stored on the DiskStation now. Copy it to e.g. the public folder, and then on the DiskStation run the following commands:
cd ~mkdir .ssh mv /volumes1/public/id_rsa.pub ~/.ssh/authorized_keyschmod 700 .ssh chmod 644 .ssh/authorized_keyschown -R root .ssh chown -R root .ssh/authorized_keys
Now type in reboot to restart the DiskStation.
The next login from your client should not ask you for a password any longer. If you want to use rsync via SSH to backup without passwords, just use the SSH parameter as following:
rsync -e '/usr/bin/ssh' /source email@example.com:'/volume1/destination/'
Improvements and suggestions welcome!