1827819 Members
1659 Online
109969 Solutions
New Discussion

Re: .bash_history

 
Harstad
Advisor

.bash_history

Hi All

I´ve defined for "root" (.bash_profile)the following :

HISTFILE=/.bash_history
HISTSIZE=1000

Checking the .bash_history there are no new entries,,

Thanks
10 REPLIES 10
Jerome Henry
Honored Contributor

Re: .bash_history

hi,
Should be
HISTFILE=/root/.bash_history
HISTFILE=1000
export $HISTFILE

hth

J
You can lean only on what resists you...
Harstad
Advisor

Re: .bash_history

Hi

less .bash_profile

HISTFILE=/root/.bash_history
HISTSIZE=20480

export both one,,,

Login again,,,and there are no entries in .bash_history

strange,,,
Steven E. Protter
Exalted Contributor

Re: .bash_history

log on as root

env | more

see if the variables are set.

If not, take actons already recommended.

Check the permissions on .bash_history

They need to be rw by the owner and root needs to own it.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Harstad
Advisor

Re: .bash_history

Hi

All checked,,and continuos without entries

Thanks

Todd McDaniel_1
Honored Contributor

Re: .bash_history

I have similar in my .profile, but I have $HOME defined so that it will always put it in the current user's home dir...



REAL equals the user name as you su to root.

REAL=`logname`

HISTFILE=$HOME/.sh_$REAL
export HISTFILE
HISTSIZE=1000; export HISTSIZE


Modify as you can to fit your shell...
Unix, the other white meat.
Martin P.J. Zinser
Honored Contributor

Re: .bash_history

Hello,

bash should create a history without you setting any of these variables. So to establish a baseline I do suggest to remove the current
.bash_history and remove the environment variables from the profile.

The login again, check if the history file gets/created filled.
In teh next step put in your environment variables again. Put echo statements in the script to make sure it actually gets executed during root login,
use printenv | grep -i hist to make sure the variables have been set.

HTH, Martin
Todd McDaniel_1
Honored Contributor

Re: .bash_history

The main difference with my suggestion is that each and every user will have a separate history file...

I do this b/c I have several folks who have root access and I like to keep all our history files separate just because it is neater imho.

HPUX creates a generic catch-all history file as well, but I like to break it out for each root user, not for security, but for ease of reference and esp if more than one user is logged in as root at one time, which happens occasionally.
Unix, the other white meat.
Alexander Chuzhoy
Honored Contributor

Re: .bash_history

Hi.

what does the
env |grep HIST
command returns?
there are more files for profile settings:
.bashrc
/etc/bashrc
/etc/profile


Best regards...
Basil_4
Occasional Contributor

Re: .bash_history

Harstad,

What history file are you looking at?

/.bash_history or /root/.bash_history?

Have you made sure that you are looking in root's homedir?

Finally, it may be worth reading some documentation on bash... ;-)

Todd McDaniel_1
Honored Contributor

Re: .bash_history

Basil,

Thats why I recommended using $HOME... that way you are SURE what profile you are utilizing.
Unix, the other white meat.