0

I want to maintain logfile for all fired command on server. We have more than 3 admins and I want to monitor all commands which are fired by these. Is it possible ?

user23750
  • 3
  • 2

1 Answers1

0

Step 1: vi /etc/bashrc and append the following line at the end:

export PROMPT_COMMAND='RETRN_VAL=$?;logger -p local6.debug "$(whoami) [$$]: $(history 1 | sed "s/^[ ]*[0-9]\+[ ]*//" ) [$RETRN_VAL]"'

Step 2:

Set the syslogger to trap local6 to a log file by adding this line in the /etc/rsyslog.conf file:

local6.*                /var/log/cmdlog.log

The history of all the users will be in one log.

Sharma
  • 28
  • 3