Preserving User Information

Stephen Carville stephen at totalflood.com
Thu Feb 5 13:47:51 EST 2004


On Thursday February 05 2004 06:09 am, Galen Johnson wrote:
> I think you can look at the SUDO_USER environment variable...there are a
> few others that get set as well...SUDO_UID, SUDO_GID, SUDO_COMMAND.  Of
> course, I'm assuming you are using 'sudo su - <user>' as an (poor) example
> and would really be running it as 'sudo -u <user> <command>' or 'sudo -u
> <user> -s'

Nope.  It is sudo su - <user>.  The other methods may be cleaner but the folks 
callig these scripts are already used to su and most of the developers are 
Windows users who have only recently learned to wear shoes and not make 
messes in the house. :-)

Another person suggested I use 'lognme' which seem to work OK.

> =G=
>
> -----Original Message-----
> From: Stephen Carville [mailto:stephen at totalflood.com]
> Sent: Thursday, February 05, 2004 1:04 AM
> To: Sudo Users
> Subject: Preserving User Information
>
>
> I have a few usernames that do not have a password set so can only be
> reached by using the command "sudo su - <username>".  These are used for
> the backup operators and web administrators.  Sometimes these usernames are
> used to run special programs which send out emails notifiying me that the
> program was run.  What I would like to do is to include in the emil who the
> original user was.
>
> For example if the user "jason" becomes "amanda" (backup operator) by
> typing:
>
> $ sudo su - amanda
>
> then starts a backup script by hand, I would like the email to tell me it
> was jason that started the script.
>
> I can usually discern who did what to whom by looking in the messages file
> but -- well -- did I mention I am lazy? :-)
>
> I've googled for an answer and I read thru all the archived messages that
> looked relevant but, so far. no luck.  I've also tried the !set_logname
> option but that doesn't  do it either.  I did find that sudo sets
> SUDO_COMMAND, SUDO_USER, SUDO_UID, and SUDO_GID but
> these do not survive once su is run.

-- 
Stephen Carville
UNIX and Network Administrator
DPSI
310-342-3602
stephen at totalflood.com
--
Most people prefer believing their leaders are just and fair even in the face 
of contrary evidence.  Perhaps this is because, once a man acknowledges that  
the government he lives under is corrupt and cares nothing for justice or  
fairness, that man also has to choose what he will do about it.



More information about the sudo-users mailing list