sudo su

Tom McGivern t.mcgivern at iname.com
Tue May 23 13:18:03 EDT 2000


I didn't see a reply to this note..
What would be wrong with using the -u operand?  I'm guessing, it doesn't
say in your note, that this may be something you're trying to do with
cron.
does the -u operand not do what you're looking for (so you can run the
command as differnet users?)

If in sudoers you define:
fmailid mailserver=(ALL) /usr/local/bin/fetchmail

then in a cronscript issue:
for idlist in $(cat someidlist)
do
  echo fmailidpw | sudo -u $idlist /usr/local/bin/fetchmail
done

(if you don't want to put fmailidpw in a script, then use the
no-password option in the sudoers file.)

Am I missing something.. I don't know fetchmail, so maybe I'm missing
something there...

Tom

oPFoR wrote:

> I need a perl script to run a fetchmail as a userthe perl script will
> have the user and password if i need to use it The only idea I can
> come up with is to give the user nobody sudo access to run sudo or su
> so I can bypass the password prompt, since I can't figure out how to
> pipe the password to sudo or su It is important that fetchmail is ran
> AS the user Could anybody give me suggestions on if this is safe
> enough or a safer way to approach this. oPFoR





More information about the sudo-users mailing list