[sudo-users] sudo in crontab
Bob Proulx
bob at proulx.com
Wed May 18 12:39:28 EDT 2005
Tran-Huu.Hanh at t-systems.com wrote:
> from the command prompt i can run a script with sudo.
The command line allows you to authenticate with your password. Once
authorized you have until the idle timeout to execute commands. Very
convenient and secure for the interactive command line.
> $ /opt/bin/sudo XXX.sh
>
> if I put this script with sudo - the same syntax - in a crontab, it doesn't work
The cron daemon runs in the background and there is no connection to
your interactive shell. There is no way for processes started by the
cron daemon to authenticate.
> How can I fixe the problem?
Your only 'sudo' option is to configure your sudoers configuration
file to allow the command without password authentification.
The man page has this to say:
authenticate
If set, users must authenticate themselves via a password
(or other means of authentication) before they may run com-
mands. This default may be overridden via the PASSWD and
NOPASSWD tags. This flag is on by default.
Example:
ray rushmore = NOPASSWD: /bin/kill, /bin/ls, /usr/bin/lprm
Depending upon what you are doing this is either safe or a security
issue. You will have to use your judgement to decide because only you
know your particular situation.
Bob
More information about the sudo-users
mailing list