Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with history file

Status
Not open for further replies.

ukraine12

Technical User
Mar 21, 2001
45
US
when we log on to a system with our userid and then to root we used to have a history file for each user logging to root. (.sh_hst.`logname'). now that doesn't work anymore. if i check the HISTFILE parameter with set, i see the correct HISTFILE parameter, but my history of commands is put in the default : .sh_history. so it looks like it is not set. But it is exported in the profile files, etc.

What could be wrong?
 
The first thing to check is that you have write access to $HISTFILE, if you haven't then it defaults to .sh_history - I know this sounds crazy if you're working as root but I got caught this way once.

If that doesn't work can you post the relevant chunks out of /etc/profile, .profile and set

This is an example of how we do it on our systems (note the chmod 666!)
Code:
HIST_ID=$(who am i | awk '{print $1}')
HIST_TTY=$(tty | awk -F / '{print $NF}')
export HISTFILE=/var/hist/${HIST_ID}_${HIST_TTY}_$(date +"%d.%m.%y")
touch $HISTFILE 2>/dev/null
chmod 666 $HISTFILE 2>/dev/null
export HISTSIZE=50000

Columb Healy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top