Schedule Netgear ReadyNAS Ultra 2 backups with RSYNC over SSH

The problem:

The ReadyNAS Ultra 2 allows create scheduled backup jobs on remote RSYNC servers, using its web based control panel, but not over SSH, that could be very well the only option.

The solution:

Enable root SSH access to the ReadyNAS Ultra 2 unit and (using the command line) setup a CRON job.

Step1:

Enable root SSH on the ReadyNAS unit by installing the following extension: http://www.readynas.com/?p=4203

[Note: the “root” user password is the same as the one of the “admin” user]

Connect via SSH to the NAS

$ ssh root@IP_OF_NAS

Step2:

Generate public and private SSH keys (use no passphrase)

$ ssh-keygen

Step3:

Copy the public key on the remote server

$ ssh-copy-id -i ~/.ssh/id_rsa.pub remote_server_user@IP_OF_REMOTE_SERVER

Step4:

Edit crontab and add a scheduled RSYNC task

$ crontab -e

after issuing the above command it may very well show an error like

$ netgear-nas:~# crontab -e
 no crontab for root - using an empty one
 /bin/sh: /usr/bin/editor: No such file or directory
 crontab: "/usr/bin/editor" exited with status 127

this is because the default command line text editor is not correctly configured. Switching to “vi” is needed

$ EDITOR=/bin/vi; export EDITOR

now trying again

$ crontab -e

should work and crontab can be edited with vi

[Note: “vi” is hard for the less skilled user, but basic commands are easy enough to do simple edits to text files]

Step5:

Add a RSYNC task to crontab, save and exit

30 17 * * * rsync /nas/folder remote_server_user@IP_OF_REMOTE_SERVER:/path/where/place/backup/

Final note:

Better test the above RSYNC task directly from the command line and check if it will still ask for the password, it should not. If it still asks for the password the likely issue is because of wrong permissions of the

~/.ssh/authorized_keys

file on the remote host, ~/.ssh should be 700, and ~/.ssh/authorized_keys should be 600. If it still ask for the password check the permissions on ~ (should be 700 too).

See:

http://unix.stackexchange.com/questions/36540/why-am-i-still-getting-a-password-prompt-with-ssh-with-public-key-authentication

and/or

http://www.daveperrett.com/articles/2010/09/14/ssh-authentication-refused/

Advertisements
Schedule Netgear ReadyNAS Ultra 2 backups with RSYNC over SSH