[SATLUG] cron sudo task

Matt Martz matt at sivel.net
Tue Jan 25 11:31:09 CST 2011

On Tue, Jan 25, 2011 at 11:08 AM, Richard Suberg <rsuberg at satx.rr.com> wrote:
> I have a task that is scheduled with cron and it runs the task,
> however, since it mounts a remote ftp server into the filesystem (and
> I haven't figured out the parameters for fstab) for it to actually be
> productive and mount it needs to be run root. I can manually run the
> task as sudo and it completes ok, but how can I cron the sudo run of
> the very same script without needing a password? I know running an ftp
> update script (or any script) as root is not the best security
> practice, but it is the only way I have found to accomplish this.
> Unless someone has a better suggestion, the process involved is:
> 1- mount ftp server into filesystem
> 2- cp -uRv location from (1) into a folder on my computer
> 3- umount remote ftp server.
> Currently I use fuse for mounting, and I do not have control over what
> programs are loaded on the remote server, I just need to update my
> documentation based on what they update.  Any ideas?
> Richard

You can update /etc/sudoers to allow the user to run certain command
without requiring a password.  I wouldn't allow the user to run a
script that has a bunch of commands in it, as anyone able to modify
that file could execute the commands with elevated privs, but just
specifying certain commands may work...

Matt Martz
matt at sivel.net

More information about the SATLUG mailing list