CentOS 5
Sponsored Link

Keep all histories of commands - psacct
2010/05/05
  Keep all histories of commands by accton. Histories of commands are kept in users' own history file but they are possible to delete by users himselves. So accton is useful because it is owned by root and users can not edit it.

[1] accton is included in psacct package. Install it.
[root@rx7 ~]#
yum -y install psacct
[2] Start psacct. It's OK all.
[root@rx7 ~]#
/etc/rc.d/init.d/psacct start

Starting process accounting:     [  OK  ]
[3] Output histories by a command below
[root@rx7 ~]#
lastcomm

lastcomm
root
stdin
0.00 secs Tue Oct 13 22:15

sendmail
  SF
root
__
0.00 secs Tue Oct 13 22:15

sh
zabbix
__
0.00 secs Tue Oct 13 22:15

wc
zabbix
__
0.00 secs Tue Oct 13 22:15

who
zabbix
__
0.00 secs Tue Oct 13 22:15

sh
zabbix
__
0.00 secs Tue Oct 13 22:14

fping
  S
zabbix
__
0.00 secs Tue Oct 13 22:14
[4] If you'd like to output histories for a user, execute with '--user' option.
[root@rx7 ~]#
lastcomm --user cent

bash
  S
cent
stdin
0.00 secs Tue Oct 13 22:25

clear
cent
stdin
0.00 secs Tue Oct 13 22:25

ls
cent
stdin
0.00 secs Tue Oct 13 22:25

rm
cent
stdin
0.00 secs Tue Oct 13 22:25

rmdir
cent
stdin
0.00 secs Tue Oct 13 22:25

rm
cent
stdin
0.00 secs Tue Oct 13 22:25

ls
cent
stdin
0.00 secs Tue Oct 13 22:25
[5] If you'd like to output histories for a command, execute with '--command' option.
[root@rx7 ~]#
lastcomm --command rm

rm
cent
stdin
0.00 secs Tue Oct 13 22:25

rm
cent
stdin
0.00 secs Tue Oct 13 22:25

rm
root
stdin
0.00 secs Tue Oct 13 21:23

rm
root
stdin
0.00 secs Tue Oct 13 21:15

rm
root
stdin
0.00 secs Tue Oct 13 21:15
 
Tweet