[pulseaudio-discuss] root access to audio: ALSA lib pulse.c:229:(pulse_connect) PulseAudio: Unable to connect: Connection refused

Frantisek Hanzlik franta at hanzlici.cz
Sun Feb 12 08:40:41 PST 2012


Hello list,
I want do some kind of "important traffic information" notification
system, where some system services/scripts will need access to Linux
audio device - optionaly mute/stop user's audio stream, then replay
their message, and enable user's audio again. These services will
run under some other UID than legged user, probably as root
(it won't be big security risk).
I suppose that one user is logged in graphical session (probably
XFce or other GTK based WM; not KDE/Gnome3), and potentially
listening audio.

When I'm trying now some tests, user has no audio problems. But even
he has not any audio source active, play and aplay programs started
as root cannot play sound and I get error message as:

# play some.ogg
ALSA lib pulse.c:229:(pulse_connect) PulseAudio: Unable to connect:
Connection refused
play FAIL formats: can't open output file `default': snd_pcm_open error:
Connection refused

# LANG=C aplay other.wav
ALSA lib pulse.c:229:(pulse_connect) PulseAudio: Unable to connect:
Connection refused
aplay: main:660: audio open error: Connection refused

What is correct way for achieving this goal?
Run PA in system-wide mode?
Some fake network access?

Thank in advance, Franta Hanzlik


More information about the pulseaudio-discuss mailing list