cancel
Showing results for 
Search instead for 
Did you mean: 

user command history

 
ivy1234
Frequent Advisor

user command history


In our EDP department , administrators have root password , I want to know what command that they have used , I checked /root/.bash_history and use the up arrow key to check , but only found a part of information , can advise if I want to keep all comamnd that all root user have run in the server , what can i do ? besides , if possible , if I want to have the date/time that the user run the command , what can i do ? thx
3 REPLIES
Goran Koruga
Honored Contributor

Re: user command history

Hello.

Check the man page for bash, in particular these two variables:

HISTFILESIZE
HISTTIMEFORMAT

Regards,
Goran
Ron Barak
Advisor

Re: user command history

You may want to investigate a culture shift away from using "naked" root by your administrators, to using sudo.
Ishwar_1
Frequent Advisor

Re: user command history

You can configure sudo to restrict the access level.
To monitor the commands used by the root
Add this parameter in .bash_profile of user/root. You can change the HISTFILE path to your desire directory. We have chosen /root as it is home directory for root

HISTSIZE=500
HISTFILE=/root/.sh_history
export HISTSIZE HISTFILE