Simple Shell Code, Trouble with SUDO

bealzz

Gawd
Joined
Jun 4, 2003
Messages
545
This might be the wrong place, but I thought I'd try here first.
I've got the following backup script on ubuntu;
Code:
#!/bin/sh

# remote login
LOGIN=*****

# backup server IP
BSERVER=10.210.10.109

# get today's day of the week (ie: Tuesday)
DATE=`date +%A`

# remote directory to backup to
BDIR=/OSSbackup/Cacti/$DATE

# 1st directory to backup
DIR=/etc
rsync -r -q $DIR -e ssh $LOGIN@$BSERVER:$BDIR

Well the script works great, but when I run it, it asks for the SUDO password.
I wanted to but this in the cron.daily file so that it would run everyday.
Is there a way to make this work, by that I mean run the command "sudo ./backup" without asking for the password?

Thanks
 
I don't think it's the sudo password - I think it's asking for login credentials to ssh into $BSERVER (since cron.daily should be running as root already). Look into using SSH keys (or some other mechanism to run/authenticate rsync)
 
Back
Top