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?

link|improve this question
feedback

2 Answers

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.

link|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
feedback

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).

link|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
feedback

Your Answer

 
or
required, but never shown

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