1 Reply Latest reply on Dec 21, 2012 9:07 PM by Dude!

    /root/.sessionhistory   modification

      HI Linux GURU,

      I want to setup the session history file in some different way . But i am not sure how to do this ...

      In My current Linux system this is how i am login
      su -
      so all the user when doing su - , then their command is going on /root/.bash_history.

      I want to change it
      There should be a folder under /root named as session history

      like /root/.sessionhistory

      when some one will login from that time it will create a files under /root/sessionhistory

      like /root/sessionhistory/<username><datestamp>

      sothat for each user their will be separate session history.

      IS it possible?If yes how ...

        • 1. Re: /root/.sessionhistory   modification
          The location of the session history file is stored accoding to the $HISTFILE environment variable, set a login. You could probably try to modify $HISTFILE and experiment with history -w and history -r commands. The challange will be to find out what user did the su - root command. I would not recommend to pursue this any further, since it creates a very exotic setup.

          I think the easiest solution to your problem is the sudo command. The sudo command will execute a command as user root, but the session history will be kept in the users session history file. You can modify the /etc/sudoers file using the visudo command to add uers to sudoer's list and also restrict what commands they can use on an individual or group basis. The sudo command will also give you more control and security because it does not prompt the user for the root password, but their own user account password.
          1 person found this helpful