Strona główna / Społeczność / Blog / Log all bash commands to file or remote server

Log all bash commands to file or remote server

On CentOS 7 you can log all commands to syslog an then to local file or even to remote server.

Send all commands to syslog

Create file /etc/sysconfig/bash-prompt-xterm:

and change, to be executable:

Configure syslog to send messages from local6 facility to separate file

Create file /etc/rsyslog.d/bash.conf:

finally:

Now you can monitor commands:

Log command using audit

Alternatively you can use audit - create /etc/audit/rules.d/bash_history.rules:

but logs are not very human friendly:

and you may also want to log execvp, execl, execveat etc.

Sources:

https://askubuntu.com/questions/93566/how-to-log-all-bash-commands-by-all-users-on-a-server

https://unix.stackexchange.com/questions/86000/how-can-you-log-every-command-typed

http://whmcr.com/2011/10/14/auditd-logging-all-commands/

Komentarze

Log in or create a user account to comment.

Ten kto umie pisze kod, ten kto nie umie pisze książki..., albo blog.

Pon Wt Śr Czw Pt So N
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30