I want to use cron in Linux to run backup scripts of various files in the system. The owners of these files are different users. Is it better to add entries in the cron of each user separately or run one job on the root account to bypass all access settings. What is the good practice in this activity?

I also want these files after backup to be sent via scp to another server.


Only add entries in the cron of each user separately if you want the users to be able to control (modify, disable, enable) the process. (In order words: don't :-))

For copying the backup to a remote site, I'd use rsync rather than scp, especially when the connection is unreliable.


I'd argue that it's better to run a single cron job as root - but to do do in such a way as to maintain permissions. By doing it this way you don't need to worry about new ysers or corner cases, the timing of backups don't need to be finessed, and it's one less thing to go wrong.

There are lots of ways of preserving permissions depending on your environment - which you have not sdequately described.

Look at rsync and rsnapshot for well-accepted dolutions if backing up optionslly using the scp protocol. +There are lots of solutions though). If disk and io is "cheap", also consider snapshots and block level backups.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.