之前有介紹過 – history功能介紹,另外,還有一篇也是記住使用者執行過的指令 – 記錄 user 執行過的指令,現在,在進一步的將時間,帳號…等資訊也保留下來!
PROMPT_COMMAND='{ date “+[ %Y/%m/%d %H:%M:%S `hostname -s` `whoami` ] `history 1 | sed “s/^ *[0-9]* //i" `"; }>>/var/log/history.log’ |
開放 file system permission:
最後記錄的結果如下:
將『系統時間』、『hostname(主機名稱)』、『登入的帳號』、『指令』分別記錄到檔案中!