This discussion is archived
1 Reply Latest reply: Dec 21, 2012 1:07 PM by Dude! RSS

/root/.sessionhistory   modification

Ani Newbie
Currently Being Moderated
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
username
password
su -
rootpasssword
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 ...

Regards,
Ani
  • 1. Re: /root/.sessionhistory   modification
    Dude! Guru
    Currently Being Moderated
    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.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points