Monday, March 25, 2013

Keep all histories of commands by action-psacct

penguin-centos-logo

Keep all histories of commands by action. Histories of commands are kept in users' own history file but they are possible to delete by users him selves. So action is useful because it is owned by root and users can not edit it.








[1]


action is included in psacct package. Inställ it.

 

[root@dlp ~]# yum -y install psacct
Start psacct. It's OK all, all histories of commands are kept.

 

[root@dlp ~]# /etc/rc.d/init.d/psacct start 


Starting process accounting: [ OK ]



[root@dlp ~]# chkconfig psacct on


 

Output histories of commands by a command below.

[root@dlp ~]# lastcomm


bash          S               cent           ttyS0         0.01 secs Mon Jul 11 21:29
id                               cent           ttyS0         0.00 secs Mon Jul 11 21:29
bash          F                cent           ttyS0         0.00 secs Mon Jul 11 21:29
consoletype                cent           ttyS0         0.00 secs Mon Jul 11 21:29
bash          F                cent           ttyS0         0.00 secs Mon Jul 11 21:29
dircolors                     cent           ttyS0         0.00 secs Mon Jul 11 21:29
bash          F                cent           ttyS0         0.00 secs Mon Jul 11 21:29
tput                            cent           ttyS0         0.00 secs Mon Jul 11 21:29
tty                              cent           ttyS0         0.00 secs Mon Jul 11 21:29
bash          F                cent           ttyS0         0.00 secs Mon Jul 11 21:29
hostname                   cent           ttyS0         0.00 secs Mon Jul 11 21:29
bash          F                cent           ttyS0         0.00 secs Mon Jul 11 21:29
id                                cent           ttyS0         0.00 secs Mon Jul 11 21:29
lastcomm                    root           ttyS0         0.00 secs Mon Jul 11 21:29
chkconfig                   root           ttyS0         0.00 secs Mon Jul 11 21:29
psacct                         root           ttyS0         0.00 secs Mon Jul 11 21:28
touch                          root           ttyS0         0.00 secs Mon Jul 11 21:2

If you'd like to output histories for a user, execute with '--user' option.

 

[root@dlp ~]# lastcomm --user cent

bash          S               cent           ttyS0         0.01 secs Mon Jul 11 21:29
id                               cent           ttyS0         0.00 secs Mon Jul 11 21:29
bash          F                cent           ttyS0         0.00 secs Mon Jul 11 21:29
consoletype                cent           ttyS0         0.00 secs Mon Jul 11 21:29
bash          F                cent           ttyS0         0.00 secs Mon Jul 11 21:29
dircolors                     cent           ttyS0         0.00 secs Mon Jul 11 21:29
bash          F                cent           ttyS0         0.00 secs Mon Jul 11 21:29



If you'd like to output histories for a command, execute with '--command' option.

[root@dlp ~]# lastcomm --command vim

Vim            cent           ttyS0         0.06 secs Mon Jul 11 21:29

 

 

 

 

No comments:

Post a Comment