how to confirm non-root user is a qualified sudo user in a (perl)script?
as at insight.rr.com
Thu Mar 18 07:11:31 EST 2004
How about something like this?
sudo touch $tmpfile
if [ -f $tmpfile ];then
echo "Your sudo privs work fine"
echo "Sorry. Unable to use sudo"
rm -f $tmpfile
----- Original Message -----
From: "Ken Wolcott" <ken.wolcott at med.ge.com>
To: "sudo mailing list" <sudo-users at sudo.ws>
Sent: Wednesday, March 17, 2004 2:15 PM
Subject: how to confirm non-root user is a qualified sudo user in a
> 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?
> sudo-users mailing list <sudo-users at sudo.ws>
> For list information, options, or to unsubscribe, visit:
More information about the sudo-users