Historial de Linux de todos los comandos ejecutados durante todo el día, todos los días

I need to have list of all commands with time when command executed that linux user has fired during whole day, every day.

For that i created a shell script in which i used history command and scheduled in crontab. But its not giving any output.

Can any one please help me on this ? Also suggest if any other better way to do it with code.

Gracias de antemano.

dt1=$(TZ=GMT+18:30: date +%d/%m/%y)
dt=$(TZ=GMT+18:30: date +%d-%m-%y)
mkdir /tmp/comm_hist/$dt
chmod 777 /tmp/comm_hist/$dt

for user in `cat /etc/passwd | grep  "bash" | cut -d":" -f1`
su - $user <<EOF
set -o history
#history | grep "$dt1" > /tmp/comm_hist/$dt/$user.txt
history  > /tmp/comm_hist/$dt/$user.txt

preguntado el 28 de mayo de 14 a las 14:05

you're not going to provide the shell script you wrote? -

The ancient gods I delegate to in order to divinate scripts are getting tired, they would like you to post it in your question instead. -

Seems like a bit futile attempt. Whatever you do with shell command history will never show all commands executed, as shell history logging can be easily disabled, circumvented or not used at all. You might need to look into some kernel-level solutions for this kind of auditing. -

también puedes usar script when running a new shell to log all the session. Maybe a bit violent though. -

Sounds like you probably need to research the process accounting capabilities of Linux... -

0 Respuestas

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.