[TriLUG] OT: sudo runas different user

Matthew Opoka matthew at opoka.name
Thu Apr 25 10:03:50 EDT 2013


Ah!  I finally found the right combination (see below).  Groupb can now run a subset of groupa's commands as groupa with groupaenv.  The only caveat is we have to run sudo with the -E option.


Defaults:%groupb        setenv,                          \
                         env_keep=*,                     \
                         always_set_home,                \
                         runas_default=groupa,           \
                         env_file=/home/groupa/groupaenv
Cmnd_Alias      LIMITEDCMDS = /usr/bin/env,                       \
                             /opt/VENDOR/groupa/bin/command1 *,   \
                             /opt/VENDOR/groupa/bin/command2 *,   \
                             /opt/VENDOR/groupa/bin/command3 *
Host_Alias      LIMITEDHOST = hosta,hostb,hostc
%groupb        LIMITEDHOST = (groupa) NOPASSWD: LIMITEDCMDS



________________________________
 From: Matthew Opoka <matthew at opoka.name>
To: Triangle Linux Users Group General Discussion <trilug at trilug.org> 
Sent: Wednesday, April 24, 2013 5:50 PM
Subject: [TriLUG] OT: sudorunas different user
 

All,

I'm trying to run a list of commands in sudo as a different user.  That part I have working but I can't get sudo to run the commands with the target user's gnarlyenviroment.  Any ideas on the best way to do this?

Regards,

Matthew
-- 
This message was sent to: Matthew Opoka <matthew at opoka.name>
To unsubscribe, send a blank message to trilug-leave at trilug.org from that address.
TriLUG mailing list : http://www.trilug.org/mailman/listinfo/trilug
Unsubscribe or edit options on the web    : http://www.trilug.org/mailman/options/trilug/matthew%40opoka.name
TriLUG FAQ          : http://www.trilug.org/wiki/Frequently_Asked_Questions


More information about the TriLUG mailing list