Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

So my ubuntu user's .bash_history just won't show up when I hit history. So I check permissions and the .bash_history in /home/ubuntu is now owned by root. Any idea what might've happened? I checked the root user's history and didn't notice anything that would've caused this.

Also, when I use the mysql client, it appends a long string of " " to the end of some lines.

To solve BOTH issues, I chown'd the .bash_history back to ubuntu:ubuntu. Any idea why this happened?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

There's no way to know for sure what happened unless you have command auditing on your system and are willing to sift through every command executed between "when it last worked" and "when it broke".

As a wild-ass guess: You somehow executed bash as root with $HOME environment variable still set to this user's home directory. There are lots of ways to do this (e.g. su -m will preserve $HOME).

share|improve this answer
    
Yeah. I was really just throwing it out there in the hope someone else has experienced this and found an answer. Thanks for the help though! –  nowthatsamatt Oct 21 '11 at 17:47

You probably ran a command like sudo su to get a root shell. That will keep the same environment, meaning your home was used as root. If you want a root shell use sudo -i.

share|improve this answer
    
$ sudo su ; # echo $HOME → /root ; # echo $HISTFILE → /root/.bash_history –  mattdm Oct 21 '11 at 15:39
    
Yeah, I checked that out. That's not the case. :C Good thought, though! –  nowthatsamatt Oct 21 '11 at 17:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.