How to see actual username who logged in as root with sudo


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to see actual username who logged in as root with sudo
# 1  
Old 12-09-2011
How to see actual username who logged in as root with sudo

Hi,

Thanks for looking at this.

I would like to know who is actually logged in as sudo root ?
ex: i have many users given sudo rights as root, and all of they are making changes as root and it is difficult for me to know who did what ,a s it shows as rot only.

Is there any way to find or any environment variable shows actual user information ?



thanks
KRR
# 2  
Old 12-09-2011
How to see actual username who logged in as root with sudo

All commands run as sudo are logged in the log file /var/log/messages.
Have a great work Mr. Ramana.

Cheers,
Sreedhar
This User Gave Thanks to daggulasreedhar For This Post:
# 3  
Old 12-09-2011
No this didn't work for me.
Ex: i have seen grep myusername /var/log/messages, even i have done many tasks as root, ti didn't show any.

Anyways thanks for your reply.
# 4  
Old 12-09-2011
Don't know what O/S you have.

Try:
Code:
logname

This User Gave Thanks to methyl For This Post:
# 5  
Old 12-10-2011
Dear Ramana,

You might not be able to see because in your system sudo log is not configured.
You have to configure in syslog.conf to see the details. So please add the below lines in /etc/syslog.conf file and restart syslog.

# This logs successful and failed sudo attempts to the file /var/log/sudo.log
local2.debug /var/log/sudo.log


You add the above configuration in syslog.conf and restart syslog ... and make sure to touch the /var/log/sudo.log file and give full permissions. So that you can see these logs.

Cheers
Sreedhar
This User Gave Thanks to daggulasreedhar For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Red Hat

Sudo to user other than root but do not allow sudo to root

I have a set of RHEL 5 boxes running our ERP software on Oracle databases. I need to allow my DBA's to su to oracle and one other account (banner) without knowing the oracle or banner password. But I need to prevent them from su'ing to any other user especially root. I only want them to be able to... (1 Reply)
Discussion started by: westmoreland
1 Replies

2. UNIX for Dummies Questions & Answers

sudo on becoming root

Anyone able to explain why if i run "sudo -i" or "sudo -s" i am able to get into root by just keying my own password? How to avoid this from happening coz i need all the users to use su - only. (2 Replies)
Discussion started by: timmywong
2 Replies

3. UNIX for Dummies Questions & Answers

Sudo to delegate permission from non-root user to another non-root user

I've been through many threads before i decide to create a separate thread. I can't really find the solution to my (simple) problem. Here's what I'm trying to achieve: As "canar" user I want to run a command, let's say "/opt/ocaml/bin/ocaml" as "duck" user. The only to achieve this is to... (1 Reply)
Discussion started by: canar
1 Replies

4. UNIX for Dummies Questions & Answers

sudo/root access

I'm actually working with a Ubuntu-System here and have a question about executing a command with 'sudo'. I tried and got a error message like "not allowed". After this I logged in with 'sudo -s' and typed the command without 'sudo'. This worked well. Can please somebody explain me this... (0 Replies)
Discussion started by: daWonderer
0 Replies

5. UNIX for Advanced & Expert Users

Need to see what ther Root users are doing while logged in to terminal

I have a server that i need to monitor what the .bash_history file for the root user already logged in to the server I am logged in as root and have another person logged on as root and i want to monitor what they are doing: root ? :0 2010-10-19 11:54 root + pts/1 ... (1 Reply)
Discussion started by: calicowboy54
1 Replies

6. Shell Programming and Scripting

Get current logged in user from a script run as root.

Ok, so, in order to install some dependencies of a program I made, a script has to be run as root. The thing is that I have to copy some things into the home folder of currently logged in user, but the variable $HOME returns '/root' and the $USER returns 'root' :( Is there any way to see who is... (7 Replies)
Discussion started by: hakermania
7 Replies

7. UNIX for Advanced & Expert Users

How can I get sudo -u <username> to load that users profile on HP-UX

I am running a serverapplication on a HP-UX machine where I need to handle some of the commands as a specified user called "druser". When I log on as this user with the command; sudo -u druser -sit starts an instance of the shell as that user. However, it doesn't load that users .profile from... (1 Reply)
Discussion started by: ukiome
1 Replies

8. Shell Programming and Scripting

From csh script, how to know if logged in as root?

I know that when I'm logged in as root in (Solaris or Linux), I would get the # sign at the terminal screen. But from a csh script, how do I know if I'm running that script logged in as root or not? (3 Replies)
Discussion started by: newbie09
3 Replies

9. Linux

sudo, root password

Hi all.. I'm secering a RH 2.1 server, with gnome (not my choice...), as X manager. Is ther anyway to get sudo ask for root password other then the actual user's password? Like when you launch the graphical IHM to create a new user, it asks for root's password? Is there a way to do the same... (5 Replies)
Discussion started by: penguin-friend
5 Replies
Login or Register to Ask a Question