Operating System - HP-UX
1754014 Members
6037 Online
108811 Solutions
New Discussion юеВ

chnage name and location of history file for non root users

 
Roro_2
Regular Advisor

chnage name and location of history file for non root users

Hi,

I am working on HP integrity server rx1620 ( HP-UX 11i v2 June 2006).
I failed to change the name and the location of the shell history file (.sh_history) for non root users using HISTFILE variable through POSIX shell and korn shell ;
it is always created in users's home directory where it can be easily deleted.

Please advise.

Roger




5 REPLIES 5
Fred Ruffet
Honored Contributor

Re: chnage name and location of history file for non root users

Where do you set the HISTFILE variable ? Make sure the HISTFILE you set for users is not reset by another profile. Remember that both /etc/profile and ~/.profile are read at startup.

Also, don't forget to export HISTFILE.

Regards,

Fred
--

"Reality is just a point of view." (P. K. D.)
Ivan Krastev
Honored Contributor

Re: chnage name and location of history file for non root users

Use .profile in user home directory and add entry for HISTFILE:
export HISTFILE=/path/.history.$LOGNAME

This will write history for user (john) in separated file .history.john. Also make sure that all users will have permissions for /path/.

regards,
ivan
Roro_2
Regular Advisor

Re: chnage name and location of history file for non root users

Hi Fred,

Thank you for your concern.

HISTFILE varibale was set first in /etc/profile , then i set it in .profile, then in both them ; still facing the same problem .
NB : it is ok with root user.

Roger
Fred Ruffet
Honored Contributor

Re: chnage name and location of history file for non root users

Regarding man page, /etc/profile is read before .profile. Simpliest way for you should be to set, like Ivan says, "export HISTFILE=/path/.history.$LOGNAME" in the /etc/profile file and the particular setting in root's .profile. Then make sure no HISTFILE is set in users .profile.

What shell do you give your users ? Note that .kshrc is also often sourced for ksh, and .bashrc or .bash_profile for bash.

Regards,

Fred
--

"Reality is just a point of view." (P. K. D.)
Roro_2
Regular Advisor

Re: chnage name and location of history file for non root users

Hi Fred,

I modified /etc/profile as you requested ;
no HISTFILE variable in users's .profile.
The .sh_history file is always created in user's home directory

Roger