Hello Gabriel,

I think I may understand what you're experiencing.

On 5/10/07, gabriel batir <[EMAIL PROTECTED]> wrote:
> This part I don't think I understand.
> If I login on a console or using su - this is true. The history dissapears 
> after I log out.
> But I have the file /root/.bash_history with all the commands I entered wile 
> using su without the dash
> to work as root.

The trick here is that there is a difference between 'su' and 'su -'
with regards to /etc/profile.  You see, when you 'su -' you create an
interactive login that acts exactly as though you had logged in via an
actual login screen.  When this happens, /etc/profile (along with
~/.bash_profile when you're using bash) get parsed and the 'unset
HISTFILE' in /etc/profile is executed.

But when you use a normal 'su', it does not read any of the personal
profile scripts and instead only reacts to ~/.bashrc.  Since HISTFILE
is not unset as the previous user you were working as, root retains it
and history is logged during that session.

The quick fix would be to move 'unset HISTFILE' to root's ~/.bashrc.
This will give root consistent behavior between these different modes
of operation.


Jonathan
-- 
http://linuxfromscratch.org/mailman/listinfo/blfs-dev
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to