Operating System - HP-UX
1832978 Members
2757 Online
110048 Solutions
New Discussion

Re: Cannot access or open the history file for root

 
SOLVED
Go to solution
Darren Gaile
Advisor

Cannot access or open the history file for root

I having trouble getting the history file to work on a new install of HP-UX 11 for root. Normal users work fine. When logged in as root, trying the 'history' or 'fc -l' command produces the error in the subject. I've tried setting the HISTFILE and HISTSIZE varaibles and this successfully creates a .sh_history file but instead of recording the keystrokes entered, it seems to become populated with random characters. If anyone has any ideas, it would be much appreciated. It is driving me crazy. Thanks.
2 REPLIES 2
Jose Mosquera
Honored Contributor
Solution

Re: Cannot access or open the history file for root

Hi,

Check some root's .profile environment variables definition:

EDITOR=vi; export EDITOR

HISTFILE=/.sh_history; export HISTFILE
HISTSIZE=10000; export HISTSIZE

Where 10000 will be the number of the lines buffered.

Rgds.
Darren Gaile
Advisor

Re: Cannot access or open the history file for root

Thanks. That's worked. I had tried setting the value of HISTFILE in .profile but that didn't work for some reason, so I had been changing the values of HISTFILE and HISTSIZE and exporting at the shell prompt so I wouldn't need to log out and in again everytime I changed it. But that was causing rubbish to be stored in the .sh_history file. Having all the variables set in the .profile has fixed it. Thanks again.