[pulseaudio-discuss] Connect to non system-wide pulse server inside root privilege program (Asynchronous API)
Arun Raghavan
arun at arunraghavan.net
Mon Nov 11 01:40:48 UTC 2019
On Tue, 5 Nov 2019, at 3:50 PM, Andrey wrote:
> Hi all!
>
> Pf: Issue with pa_context_connect() call inside root privilege program.
>
> I have Xubuntu 19.10. On default pulseaudio server (ver 13.0) started on
> user logon with "--demonize=no" parameter. I need reroute digital sound
> from /dev/dsp to pulse. For this i install osspd package (current ver
> 1.3.2-11). I have successfully used this package previously on Ubuntu
> 16.04/18.04-3 with no any tuning. Osspd daemon get source trough CUSE
> and required root privileges. I.e. osspd call pulse as root. I copy
> user's cookie file to /root/.config/pulse/cookie. But osspd can't
> connect to pulse server again. My distribution belongs to group 2 and i
> no put users to the "audio" group (but i test opposed: nothing happens :) ).
>
> I debug osspd's slave processes (ossp-padsp) and detect what function
> pa_context_connect() return code 'connection refused'. I tried to run
> ossp-padsp as user - it connected to server successful. Then i call
> pa_context_connect() with name of server
> "unix:/run/user/1000/pulse/native" (instead NULL).... the connection is
> established! And as ordinary user and as root! It works for me now.
>
> BUT... I assume that somewhere something with settings of access rights
> to the pulse server I missed... What and where? How correctly should I
> connect to the non system-wide pulse server as root?
>
> Is this behavior of the connection process a normal(documented?) or bug?
> Can i (is it right) use this feature to select the specific user's pulse
> server to connect?
Not sure what the issue you have is, but there is one big hammer to sidestep this problem -- you can provide auth_anonymous=1 to module-native-protocol-unix in default.pa, and any local client can then connect.
-- Arun
More information about the pulseaudio-discuss
mailing list