how to confirm non-root user is a qualified sudo user in a (perl) script?

Ken Wolcott ken.wolcott at
Wed Mar 17 14:15:52 EST 2004


I am writing a perl script that needs to be run as a non-root user
but uses sudo extensively.  How do I verify in the
script (non-interactively) that the user running the script has
sudo privileges?  It looks like I need to use expect (*sigh*) to
get underneath the tty layer.  Right now it looks like I don't have
any choice but to assume that the user already has sudo
privileges.  I have looked at the sudo man pages and in the mailing list
archives but I did not find anything I thought was pertinent to the
issue I am facing.  The sudo privileges must be absolute like the
following in the sudoers file:

username	ALL = NOPASSWD: ALL

Any hints?


More information about the sudo-users mailing list