Results 1 to 6 of 6

Thread: shell logging

  1. #1
    Join Date
    Feb 2013
    Beans
    10

    shell logging

    Could you please suggest a tool or a procedure for shell logging. I would like to capture all the shell activity for all the users including root for all the shells ( bash, sh, ksh ....)

    Thanks,

  2. #2
    Join Date
    Sep 2006
    Beans
    8,627
    Distro
    Ubuntu 14.04 Trusty Tahr

    script

    I would look at using script in some capacity. What problem are you trying to solve?

  3. #3
    Join Date
    Feb 2007
    Location
    West Hills CA
    Beans
    10,048
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: shell logging

    You could write a cronjob to capture .bash_history for each user. You would need to set an environment variable to get time stamps in the history file. Root actions are stored in /var/log/auth.log.

    If you can elaborate on your specific use case, then there are probably better methods. What are you trying to do?
    -------------------------------------
    Oooh Shiny: PopularPages

    Unumquodque potest reparantur. Patientia sit virtus.

  4. #4
    Join Date
    Feb 2013
    Beans
    10

    Re: shell logging

    I would like to have all the commands executed by the users in bash shell in a single file for monitoring purpose.

    Thanks,

  5. #5
    Join Date
    Sep 2006
    Beans
    8,627
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: shell logging

    If you use the bash history, you should look at setting the 'shopt -s histappend' and 'cmdhist' options so that multiple sessions can be recorded concurrently and in a coherent manner.

    However, even with script, mentioned above, you are still going to be depending on the cooperation from the shell users. The users will still be able to erase or edit the history file or the script log. If you need something more hostile, then maybe the package auditd might have something, but I haven't used it.

  6. #6
    Join Date
    Feb 2013
    Beans
    10

    Re: shell logging

    Thanks for the suggestions.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •