Re: Sudoers list?



On Tue, Apr 04, 2006 at 10:14:05PM +0100, Daniel Carrera wrote:
Chris Bannister wrote:
I don't want to force people to run this script as root. Running stuff
as root is a really bad habit. I want this script to be as non-root
friendly as possible. There is only one step that *might* warrant root
access and that's if the destination directory belongs to root.

Just run gksudo and test for whatever error code it gives if the user
isn't in the sudoers file / gives the wrong password.

The problem with that is that is that the user still gets a password
prompt even if they are not sudoers.

But not if doing only "sudo -l" (or -v). I just tried it.
Then the return value can be tested, as already suggested, can't it?:

erik@dvalin:~$ sudo -v
erik@dvalin:~$ echo $?
0

I guess I'll just assume that the user is a sudoer and give them the
prompt...

Hopefully not. :-)

Erik

--
ubuntu-users mailing list
ubuntu-users@xxxxxxxxxxxxxxxx
https://lists.ubuntu.com/mailman/listinfo/ubuntu-users



Relevant Pages