Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • 1
    Sounds like process accounting may be useful. The shell history was never designed for logging, and if you do want to use it you have to trust all of your users. See related question on monitoring activity and a related answer. Commented Mar 27, 2012 at 15:36
  • @jw013 Thanks for the comment. However, that has to be configured and managed plus I given the information I have read I would be best off excluding directories like /proc /dev and users /home directories. This adds overhead. Whereas history is already being recorded and their connection information is known to the system connecting IP etc... This information if not already available "statically" could be set that way or stored in a variable or file and input to the history records and the performance hit would be very small or 0. Commented Mar 27, 2012 at 17:09
  • If this is on Linux, consider using auditd. I'm not sure if its logs will give you enough information. The difficulty of what you want is precisely why shared accounts are so decried. Commented Mar 27, 2012 at 21:49
  • It is on Linux, I will edit my question to make that clear. auditd is a lot like inotify you have to tell it what to monitor for changes. Individual files, directories, etc.. I don't want to go to that level of configuration. In fact (I do) but essentially don't care so much. I have puppet to handle that stuff. auditd comes with the additional load and time to setup as well. If an account is modifying something I still would like to look back in the history and see who or what is logging in and trying. Commented Mar 27, 2012 at 22:32
  • 2
    hm,since PROMPT_COMMAND= just runs normal commands before the next prompt, couldn't you write a function calling sed/awk that works on the last line of the history file to add in the information. then call that function in PROMPT_COMMAND= to append the data? it would be hackish but should do the job. Commented Apr 9, 2012 at 15:16