Hi, can you help me understand this? I have a server. I add this line in my /etc/crontab
Code:
0 17 * * * bart sh /media/backups/backup.sh
It backups files Everyday at 5PM - on a ext4 separate hard drive, backup.sh looks like this:
Code:
-rwxr--r-- 1 bart bart 994 2010-09-10 04:13 backup.sh
I'm using RSYNC to backup my MBR, /boot, and /(root). Here's the script:
Code:
#backup mbr
sudo dd if=/dev/sda of=/media/backups/mbr/lgv-server_mbr bs=512 count=1
#backup /boot
sudo rsync -avz --delete /boot/ /media/backups/boot/
#backup /(root)
sudo rsync -avz --delete / /media/backups/root/
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?
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.
Bookmarks