Is there a way to find a log of all the commands that have been run by a user on Ubuntu 11.10 Server? I need to find out what my friend ran to install a program.
Asked
Active
Viewed 2.5k times
2 Answers
10
If you use something like bash as a command interpreter, you could check the history.
more /home/user/.bash_history
Bahaïka
- 935
-2
Follow these instructions (revised from this answer).
Modify the
/etc/bash.bashrcAppend the below line the end of that file
export PROMPT_COMMAND='RETRN_VAL=$?;logger -p local6.debug "$(whoami) [$$]: $(history 1 | sed "s/[ ][0-9]+[ ]//" ) [$RETRN_VAL]"'Create a new file
/etc/rsyslog.d/bash.confAdd the line to the file
local6.* /var/log/commands.logAdd line to the file
/etc/logrotate.d/rsyslog.Nearby:
/var/log/mail.warn /var/log/mail.err [...] /var/log/messageAdd this
/var/log/commands.logRestart the rsyslog.
sudo service rsyslog restart