Hi, can you help me understand this? I have a server. I add this line in my /etc/crontab
It backups files Everyday at 5PM - on a ext4 separate hard drive, backup.sh looks like this:
0 17 * * * bart sh /media/backups/backup.sh
I'm using RSYNC to backup my MBR, /boot, and /(root). Here's the script:
-rwxr--r-- 1 bart bart 994 2010-09-10 04:13 backup.sh
Did you notice I put sudo in there? Why? Because if I don't use SUDO, root-owned-files won't get copied/backedup - right?
sudo dd if=/dev/sda of=/media/backups/mbr/lgv-server_mbr bs=512 count=1
sudo rsync -avz --delete /boot/ /media/backups/boot/
sudo rsync -avz --delete / /media/backups/root/
So I use SUDO. However, why doesn't it ask for a Password? I'm asking because I've seen people doing additional work just for a script to use SUDO. For example, editing the /etc/sudoers file, and putting there your User Name w/ NOPASSWD and PATH-to-your-script.
But me, I don't. I just put there SUDO + (command), and it has ALL the privilege of SUDO.
Not that I don't like this, but is this Normal? Shouldn't it ask for a password? Is this a SECURITY issue?
Why is this so? Is there something I need to understand about crontab, scripts, permissions in scripts, rsync, what have you or None?
Can you help me? Thanks for reading.