[pulseaudio-discuss] Failed to connect pulseaudio server using user account A, when pulseaudio server is launched by different user account B

Chen, Hao H hao.h.chen at intel.com
Wed Nov 26 01:29:17 PST 2008


Thanks, Cloin.

1> >>> for a general desktop system, per-user daemons are recommeneded. 
=> I see. It seems PA daemon is not supposed to be used simultaneously. It's better to launch daemon for each user.

2> >>>For totally separate users, yes, this is normal. If you start as your user and su to another user, if the X11 access is granted, then, as I describe above, you can piggy back on to that for other users without any problems.
=> you mean X11 PA plugin should have been installed? If not, I guess another user is no way to access PA server.

3> It's said that users in same group "pulse" or "pulsexxx" could share PA server, is that real? What's the usage of those pulse groups?

Hao

-----Original Message-----
From: pulseaudio-discuss-bounces at mail.0pointer.de [mailto:pulseaudio-discuss-bounces at mail.0pointer.de] On Behalf Of Colin Guthrie
Sent: 2008年11月25日 18:32
To: pulseaudio-discuss at mail.0pointer.de
Subject: Re: [pulseaudio-discuss] Failed to connect pulseaudio server using user account A, when pulseaudio server is launched by different user account B

Chen, Hao H wrote:
> Hi, 
> 
> The problem is: Failed to connect PA server using user account A, when pulseaudio server is launched by different user account B. Is it normal?
> 
> [Description:]
> ===========
> 1> If pulseaudio server is launched by normal user, su to another user, ex. "root". 
> Log
> -----
> [root at localhost data] pacmd
> E: pacmd.c: No PulseAudio daemon running
> [root at localhost data]# paplay s16_44khz_stereo.wav
> Connection failure: Connection refused
> [root at localhost data]# ps -eaf | grep pulseaudio
> haohaot   7746  7724  0 11:26 pts/15   00:00:00 pulseaudio -D 
> root      7861  7800  0 13:18 pts/16   00:00:00 grep pulseaudio

Well in the case of root, it can work in strange ways!

If the root user is able to access the X11 root window of your user, 
then it can, in theory read the PULSE_COOKIE variable stored therein, 
and thus be allowed to access your pulse server.

Run:
xprop -root | grep PULSE

If that gives you some results as your first user then you're already on 
to a winner! If you don't get anything then the recommended X11 
initialisation (via XDG) has not worked.

Try running (as your user) the start-pulse-x11 script (I'm assuming a 
0.9.13+ version of pulse here).

After runnign this script, run the xprop cmd again. THis time you should 
see some more interesting stuff.

When you su to root, try the xprop again. If it still works then root 
should be able to access your user's PA daemon fine. It's has the server 
and the cookie so all is well!

If your root user does not have this info, it's unlikely to be permitted 
access.

> 2> if pulseaudio server is launched by root, and another normal user to access PA server, failed too.
> Log
> ----
> [haohaot at localhost data]$ pacmd
> E: pacmd.c: no PulseAudio daemon running
> [haohaot at localhost data]$ paplay s16_44khz_stereo.wav
> Connection failure: Connection refused
> [haohaot at localhost data]$ ps -eaf | grep pulseaudio
> root      7885  7867  0 13:21 pts/15   00:00:00 pulseaudio -v
> haohaot   7919  7892  0 13:21 pts/16   00:00:00 grep pulseaudio
> 
> Tested on 0.9.12 and 0.9.10. (I remember ever tired on 0.9.13, the same result)


Ditto of su'ing ot another user. If that user can display X apps then it 
should be able to access your PA too.


> [Comments]
> ===========
> It seems only the user who launched the PA server, could connect. For other user, even root, it failed. Is it normal??

For totally separate users, yes, this is normal. If you start as your 
user and su to another user, if the X11 access is granted, then, as I 
describe above, you can piggy back on to that for other users without 
any problems.

> I found one similar problem before:
> Ticket #222 "pacmd doesn't work with pulseaudio running as a system-wide daemon"

That's a different problem.

System wide daemons are generally not recommended. It's OK in an 
embedded environment or if you have a need that totally separate users 
play sound simultaneously (e.g. in a multi-seat setup with only one 
sound device), but for a general desktop system, per-user daemons are 
recommeneded.

console-kit will keep track of the active user (e.g. the one who has 
their desktop displayed) and will grant ACL access to the sound device. 
Pulse integrates with console-kit and is told if the active user is not 
longer permitted access (e.g. the "Switch User" functionality is 
initiated to allow a second user to log in).

For a system wide daemon, you should lock down what users can do in your 
server (e.g. like loading modules) than that's why pacmd doesn't run.

HTHs

Col

-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
   Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
   Mandriva Linux Contributor [http://www.mandriva.com/]
   PulseAudio Hacker [http://www.pulseaudio.org/]
   Trac Hacker [http://trac.edgewall.org/]

_______________________________________________
pulseaudio-discuss mailing list
pulseaudio-discuss at mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


More information about the pulseaudio-discuss mailing list