How to log all bash history commands to syslog

shopt is a built-in bash variable that enables bash history to be written to /var/log/messages.

shopt -s syslog_history

If you want to unset it, run the following command.

shopt -u syslog_history

In order for these audit activities to persist in all bash sessions, append the following to the bottom of /etc/bashrc file.

shopt -s syslog_history

Leave a Reply

Your email address will not be published. Required fields are marked *