Linux – Safe to run backup script as root? or other way to aproach privileges

backuplinuxpermissionsscripting

I'm writing a backup script in BASH on a linux machine (gentoo)

The script will backup all folders in a certain directory.

The folders will have varying privileges and belong to different users and groups.

In order to make sure my backup script has read privileges to all the the files and folders I'm tempted to run the backup script as root.

Is this safe? Are there any specific techniques to achieve this without root privileges?

Best Answer

cron is the best way to do that, and yes certain scripts need to run with root otherwise you are not able to read from users home directory with 700 privileges.

Related Topic