1752700 Members
6135 Online
108789 Solutions
New Discussion юеВ

Re: Root's .sh_history

 
SOLVED
Go to solution
Brian Atkins
Advisor

Root's .sh_history

Recently, when I was logged in as root, I noticed that I wasn't able to esc-K to repeat previous commands. I looked at .sh_history, but it had nothing there. The permissions were fine on the file, but I can't seem to find out why nothing is being written there. It actually worries me a bit, because I can't see what other SA-types have been doing to the system (or who knows who else).
5 REPLIES 5
Kofi ARTHIABAH
Honored Contributor

Re: Root's .sh_history

Brian:

You may want to verify that the env variable HISTFILE is defined and set to the ~/.sh_history file - you may need to add it to your /etc/profile

#echo "export HISTFILE=~/.sh_history" >> /etc/profile

logout and back in and voila
nothing wrong with me that a few lines of code cannot fix!
Rick Garland
Honored Contributor

Re: Root's .sh_history

In the .profile for root, input the following:

VISUAL=vi
HISTFILE=$HOME/.sh_history
export VISUAL HISTFILE

You can also put in the /etc/profile for everyone to use.
James R. Ferguson
Acclaimed Contributor

Re: Root's .sh_history

Brian:

If I want to cover my tracks, I'm sure not going to leave what I do in the history file!

Maybe one of your other admins deliberately nulled it to prevent someone else from inadvertantly reissuing a command that shouldn't be issued twice. I do this myself for my own protection.

Regards!

...JRF...
Rick Garland
Honored Contributor
Solution

Re: Root's .sh_history

As a further mention, check the shell being used for the user.
Brian Atkins
Advisor

Re: Root's .sh_history

Thanks, guys!
I did a pwck, which proved Rick's point. The shell was indeed invalid.
However, as a point of good measure, I added the HISTFILE=~/.sh_history to the profile.