1

is there a way to stream/monitor/log bash history to prevent the ability of someone hiding stuff?

would like to monitor and know every little thing that happens so that the list of commands and edited files can be checked and watched.

Would rsync be an ideal way or is there an actual program that can be installed.

4 Answers 4

3

No you can't, primarily because it's trivial for any user to prevent bash from writing the history file in the first place.

If you really want to audit system activity, use the auditd daemon; that's what it's for.

1
0

You'd probably have to modify the bash shell programming to do what you want. Although there is history provided by the bash shell, this can be easily overridden by the user. Of course, then from bash a user could go to another shell without logging.

0

But if bash was the only shell available to the user, it could still work. Perhaps by using a cron job to rsync the history file periodically. It would be quite easy to tamper with the file in 1 minute however.

An Alternative: Setup a named pipe called ~/.bash_history which uses netcat to forward the commands from bash to a remote host?

0

Look into Extended file attributes - Wikipedia, the free encyclopedia, this will help you keep your user's .bash_history file without tempering with it.

Not the answer you're looking for? Browse other questions tagged .