Basically inside a sudo session, even one emulating another none root user (sudo -u username command) there is no sound available.
Inside a sudo session sound appears disabled.
I need sound, how do I fix it?
I've solved this before by running pulseaudio in "system mode" where it is available to all users instead of just the user running the desktop. You can read more about it here:
Note that there's some good reasons not to do this:
Unfortunately I don't know of any other way to solve the problem on a system running pulseaudio.
I got around this problem by enabling 'network server' in pulseaudio preferences.
To get the pulseaudio preferences manager, open up a terminal and type
Then run it as your usual login (i.e. DON'T run it using
On the Network Server tab, click "Enable network access to local sound devices", leaving all other settings as they are.
Close the PulseAudio Preferences window and you're done. You should only need to do this once.
As I understand it, this method avoids some of the security issues of running pulseaudio in 'system mode' but, for example, the programs you run using
Because we have not ticked 'Allow other machines on the LAN to discover local sound devices' or 'Don't require authentication' your sound device is not actually available to other computers on the network. This setting just allows your computer to connect to itself, you don't need to be connected to a network at all.
NOTE: If you are running a transparent proxy (if you don't know, you're probably not), you have to ensure loopback TCP connections are not being redirected at the NAT level. To add an exception directly to iptables type