[pulseaudio-discuss] How can other users play sound on Mandriva Cooker?

Colin Guthrie gmane at colin.guthr.ie
Tue Mar 25 02:57:34 PDT 2008


Hi Shlomi,

It would have probably been wise to ask this on the cooker mailing list
first but seeing as you're here now ;)

Shlomi Fish wrote:
> Hi all!
> 
> I'm using Mandriva Cooker (the bleeding edge of Mandriva Linux) with
> Pulseaudio. However, other users I su - to cannot play sound despite
> the fact that they belong to the "audio" group. Pulseaudio is started
> like this:


>   # Do some pid file tidy up
>   PIDFILE=/tmp/pulse-$USER/pid
>   if [ -f $PIDFILE ]; then
>     PID=$(cat $PIDFILE)
>     if [ -f /proc/$PID/status ]; then
>       PNAME=$(cat /proc/$PID/status | grep ^Name | awk '{ print $2 }')
>       if [ "pulseaudio" != "$PNAME" ]; then
>         # This is a bogus pid file and pulse will fail to start.
>         rm -f $PIDFILE
>       fi
>     fi
>   fi

This whole bit can technically be removed now but I forgot to tidy up
after myself post 0.9.8 when better PID tidyup was added to pulse itself.


> And:
> 
> <<<<<<<<<<
> shlomi:~$ ls -l /tmp/pulse-shlomi/
> total 4
> srwxrwxrwx 1 shlomi shlomi 0 2008-03-22 19:40 native
> -rw------- 1 shlomi shlomi 5 2008-03-22 19:40 pid
> 
> Any suggestions and best-practices will be welcome.

To explain:

The pulse libraries (which get invoked when playing sound) will check
the current user and see if they can access /tmp/pulse-$USER for a
control socket with which to communicate with the pulse daemon. When you
su or su - the $USER is root and therefore it doesn't look at your
/tmp/pulse-shlomi (initially).

It then falls back to other methods, e.g. network. In theory it should
follow your X11 cookie, but I'm not 100% sure that's working right now -
I'll need to look.

Certainly how my machine appears to be able to play sounds as root at
the moment is because I have the network enabled in paprefs and I have
"Don't require authentication" ticked" If I turn this off, root cannot play.

Hope this helps.

Col





More information about the pulseaudio-discuss mailing list