How do I change the .bash_history file location?
I'm running CentOS 6.x and want to move the .bash_history to a different location.
The home directories of my users are (because I run a VPS) in /var/www/vhost/<domain>.<tld>
which is FTP accessible (and it should be).
Because of this, I have changed the AuthorizedKeysFile
for SSH connections out of the normal ~/.ssh/authorized_keys
since FTP connections would easily be able to locate them.
At the same time I want to move the .bash_history
file to /home/%u/.bash_history
where %u
is the current user.
You need to set HISTFILE for your users to the location you need, set the following in .bash_profile for the user, and for new users set it in the user skeleton directory, most likely /etc/skel/.bash_profile
export HISTFILE=/home/$USER/.bash_history