Article 5NRJ2 Pulseaudio cannot find daemon when ran within sudo

Pulseaudio cannot find daemon when ran within sudo

by
happysmash27
from LinuxQuestions.org on (#5NRJ2)
I am sick and tired of Cloudflare always blocking me from browsing the web over Tor. I have a VPN which works fine, however.

But, I cannot run this VPN system-wide on one of my machines, as this interferes with some servers it is hosting. Therefore, I run it within a separate network namespace for programs which need to use it.

As network namespaces cannot be run as a normal user, to my knowledge, I use sudo to go into the namespace, wrapping another sudo to run the command as my normal user (names wrapped in <> are placeholders):

Code:sudo ip netns exec <VPNNamespace> sudo -u <username> <command>This works great for most programs, but for my web browser, it causes my audio to be unavailable.

Upon some experimentation, it appears that the root issue is not in fact the name space itself, but sudo, as even if I run:

Code:sudo -u <username> pacmd list sinksWith the same username where audio works fine, this command fails with:

Code:No PulseAudio daemon running, or not running as session daemon.And all audio applications are completely silent.

Jack audio, and everything else, work fine, but this does not.

So my question is, how does PulseAudio find its daemon, and how can I relay this information to programs within a sudo session?latest?d=yIl2AUoC8zA latest?i=ktLe1I_5S3I:wHC0GnoGdAQ:F7zBnMy latest?i=ktLe1I_5S3I:wHC0GnoGdAQ:V_sGLiP latest?d=qj6IDK7rITs latest?i=ktLe1I_5S3I:wHC0GnoGdAQ:gIN9vFwktLe1I_5S3I
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments