HPE 9000 and HPE e3000 Servers
1753819 Members
8763 Online
108805 Solutions
New Discussion юеВ

commands history to 2 files

 
Maurice Peterse
Frequent Advisor

commands history to 2 files

Is there a way to obtain more information from the .sh_history file in each users directory.
(http://forums.itrc.hp.com/cm/QuestionAnswer/1,1150,0x7394ee3e323bd5118fef0090279cd0f9,00.html)
Rick,
for each command it maybe dificult to do, but I keep the date of each login buy adding that last line to the user's profile:
HISTFILE=$HOME/.sh_history
export HISTFILE
echo "`date`\n" >> .sh_history

one more question
can i also send the commands for that 1 username
to another file (that he can't edit) + the ime/date-stamp?
so to sh_history AND /tmp/sh_history
4 REPLIES 4
Vincenzo Restuccia
Honored Contributor

Re: commands history to 2 files

cp -p .sh_history /tmp/sh_history in crontab ?
Maurice Peterse
Frequent Advisor

Re: commands history to 2 files

i need a more direct way.
cause i dont want any time between the writing to
the sh_history and the backup file.
In case the user himself changes the file meanwhile...

more ideas?
:)
Vincenzo Restuccia
Honored Contributor

Re: commands history to 2 files

Victor BERRIDGE
Honored Contributor

Re: commands history to 2 files

What about using multiple links to .sh_history
like:
$ pwd
/home/vbe
$ su
Password:
# cd /var/adm/root
# umask 027
# ln -s /home/vbe/.sh_history titi
ll titi
lrwxr-x--- 1 root sys 21 Jun 21 19:17 titi -> /home/vbe/.sh_history
# ll -ld /var/adm/root
dr-xr-x--- 2 bin bin 96 Jun 21 19:17 /var/adm/root
#