If I take an mp3 file and try to hear it using my normal user account using sox file.mp3 -d
, it works flawlessly. However, if I try to do the same thing after doing sudo su
, it yields: Home directory not accessible: Permission denied
.
The use-case is as follows:
I have my .bashrc linked between my root and my normal user accounts. A particular line in my .bashrc that works using google_speech (which leverages sox, which seems to use pulseaudio as the default):
function sayhi() {
if [ "$EUID" -ne 0 ]; then
printf "Hi, $USER! Your directory is currently "${PWD}""
google_speech -l en "HELLO $USER!"
else
printf "Woah, we have a Superuser on our hands. Best be careful!"
google_speech -l en "WARNING: ROOT ACTIVATED"
fi
}
sayhi &
This means if I do something like sudo su
I should end up with my computer talking to me. Instead, I get:
Home directory not accessible: Permission denied
.
How do I fix this?