Sudoers list?

Matthew Kuiken matt.kuiken at
Wed Apr 5 04:03:51 UTC 2006

Erik Christiansen wrote:
> 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 at dvalin:~$ sudo -v
> erik at dvalin:~$ echo $?
> 0
Hmm, I tried the same thing, and got:

mtkuiken at mtk-laptop:~$ sudo -v

So it prompted me for a password. Maybe you were within the sudo timeout 
period from a previous command?


More information about the ubuntu-users mailing list