[sudo-users] sudo & runas_default

alexander lunyov sol289 at gmail.com
Wed Feb 14 04:23:04 EST 2007


There's some commands requiring non-root target user to run, and i
want to run them always as this target user, by default. In my example
'prgusr' is target user for running COMMANDS. Here's sudoers file:

User_Alias USERS = test

Cmnd_Alias COMMANDS = /usr/local/bin/command1,/usr/local/bin/command2

Defaults:USERS    always_set_home
Defaults>prgusr     runas_default=prgusr


My logic is: all that runs as prgusr should runas_default=prgusr, so
user would not specify '-u prguser' every time he run COMMANDS. Saving
sudoers file in visudo i got warning:

Warning: runas_default set after old value is in use near line N

(N is the line with runas_default).

and of course it is not working:

# sudo command1

it ask for password, and after that it says that user who run this
command is not allowed to run 'command1' under user 'root'

Yes, i read about that warning in visudo(8), but it seems that it is
not that case.

In general i need to make user 'test' could run 'sudo command1' as
target user 'prgusr1' and 'sudo command2' as 'prgusr2', automagically,
without specifying every time '-u prgusr'.

I will appreciate any suggestions.

your sweet isn't ready yet

More information about the sudo-users mailing list