I'm looking to create a script that logs into a machine and pulls back files to a NAS server. The files will be put into a compressed file as it downloads.
Because the script will be looking to download files with varying owners and permissions, it will need to run as root to make sure it captures everything in the home directory.
I have edited my visudo file to allow the backup user to sudo tar without a password. But there is something stopping the command from running successfully:
backup ALL=NOPASSWD: /usr/tar
Command ran from the NAS:
ssh -t backup@192.168.1.4 "sudo tar -zcf - /home/" > /var/backup/server1.tar.gz
Any help would be great, thanks
Update: It would of been good to know why I was down voted for this question.