Operating System - Linux
1829028 Members
2646 Online
109986 Solutions
New Discussion

Re: need list of command which was run by a local user

 
SOLVED
Go to solution
praveen..
Super Advisor

need list of command which was run by a local user

Hi,
As per requirement, i have created a local user "db2root" with user / group id 0 (root).

I want to get the list of all the commands which were run by this user of last 24 hours.

sendmail is already configured to generate the emails alert.

Please suggest
3 REPLIES 3
Alexander Chuzhoy
Honored Contributor
Solution

Re: need list of command which was run by a local user

lastcomm is the tool that would do what you need.
read `man lastcomm`

Again you will need to work with grep...
Best regards.
Ivan Ferreira
Honored Contributor

Re: need list of command which was run by a local user

lastcomm will help if you enabled audit. A more elegant solution may be snare.

The simplest is use the HISTORY file.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Steven E. Protter
Exalted Contributor

Re: need list of command which was run by a local user

Shalom,

Remember the HISTORY file is great, but to record commands of the user it must be writable to the user.

Therefore if the user wishes to hide something from you it is a trivial matter.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com