1751693 Members
4586 Online
108781 Solutions
New Discussion юеВ

Re: su logs

 
SOLVED
Go to solution
Md. Farhan A Azam
Trusted Contributor

su logs

Hi Gurus,

All su id i can get from syslog.log, but can you pls tell me that from where we can check that commnds executed by the user who has done su from normal userid to root.

OS - 11.11
Server - SD32A, RP4440, RP3440

thnx...farhan
10 REPLIES 10
Jeeshan
Honored Contributor

Re: su logs

You can find the su log from /var/adm/sulog.

Normally you can see the .sh_history file to see what is executed by the user at that time.
a warrior never quits
Basheer_2
Trusted Contributor

Re: su logs

Yes,

Ahsan is right.

This is what I used to do.
We also modify the user .profile and make the history file with the date and time stamp.
each time the user logins all the commands are logged into that file (that has date-time stamps).

The drawback of this is there are too many files created. for example if the user logs in and logs out 100 times, there are 100 files created.

if you go this route then, you may need to cron this to get rid of these files.

let me know if you need the profile I will cut and paste it.
Suraj K Sankari
Honored Contributor

Re: su logs

Hi,
From syslog.log you can find out which user is using "su" command.

>>from where we can check that commnds executed by the user

Go to that users home directiory and check .sh_history file there you can find the commands.

Suraj
Dennis Handly
Acclaimed Contributor

Re: su logs

>where we can check that commands executed by the user who has done su from normal userid to root.

You can't accurately do this. If the user does "su -", you could look at root's history file but the user could erase it. If no "-", again the user could erase his history.

One suggestion is to use sudo for "each" command so they are all logged.
Md. Farhan A Azam
Trusted Contributor

Re: su logs

Hi Gurus,

i checked in .sh_history, but the command which i am executing is not getting logged in history.

thnx...farhan
Dennis Handly
Acclaimed Contributor

Re: su logs

>I checked in .sh_history,

Which su(1) option did you use, "-"?
Which .sh_history? What does "echo $HISTFILE" show once you su?

This is why this isn't accurate.
Md. Farhan A Azam
Trusted Contributor

Re: su logs

Hi Dennis,

i use "su -", and its geeting logged in sulog, but the other commands which i am executing (i.e. top, bdf)is not getting logged in .sh_history of root.


thnx...farhan
Md. Farhan A Azam
Trusted Contributor

Re: su logs

echo $HISTFILE

its shows,
# echo $HISTFILE
sh: HISTFILE: Parameter not set.
#
#
# echo $ HISTFILE
$ HISTFILE
#

thnx...farhan
Dennis Handly
Acclaimed Contributor
Solution

Re: su logs

># echo $HISTFILE
sh: HISTFILE: Parameter not set.

Since root doesn't have a history file, nothing will be logged. You must set HISTFILE in your .profile.