How to make sudo use your login name

22 11 2010

This is being tossed out there as a handy reference to sysadmins around the world.
Sudo is a magnificient tool for Unix / Linux based systems that allows a single command to be executed as the root / privileged user. The advantage is that the command is logged to the syslog, and access to sudo-managed tools can be tightly controlled via /etc/sudoers.
One problem that comes up a lot is that logged activities on a host will show up as ‘root’ when sudo is used to invoke them, when what you really want is to know who initiated the command.
The sudoers file can include an option that tells sudo to not reset the users login name when escalating priveleges. The option is:

Defaults        !set_logname 

Putting this option in sudoers will make it so RCS checkins and other tasks will log as the user who invoked the sudo, not root.

Advertisements

Actions

Information

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: