[pulseaudio-discuss] Accessing audio as root

Lennart Poettering lennart at poettering.net
Thu Dec 17 01:50:22 PST 2009


On Thu, 26.11.09 01:27, David Csercsics (aarg at shaw.ca) wrote:

> 
> On Thu, Nov 26, 2009 at 04:51:25PM +0800, Markus Rechberger wrote:
> > Hi,
> > 
> > I've been working quite a while with pulseaudio, one thing that breaks
> > alsa compatibility is that since PA is user based root is not allowed
> > to access audio.
> > This always worked with native Alsa even if root is not in the audio group.
> 
> I have a similar question here. What should i do if I need to
> configure things so that sound can play as root as well as my normal
> user and [preferably before I log in. It is considered incorrect to run
> pulseaudio in system wide mode and I don't know that I want to take the
> performance hit anyway. If it matters I don't habitually run X. I bring
> that up because it seems pulseaudio interacts quite a bit with hal and
> the X sessions among other things and this case is not covered in the
> documentation exactly. I'm running this on my laptop so it's not really
> the embedded case that system mode is designed for but I'd like the low
> power and hotplug parts of pulseaudio and better mixing than dmix to
> try to get some more or less useful music playing out of the laptop. The
> laptop is currently running Fedora but help that is not distro specific
> would be useful because I sometimes need to fix other Linux boxes and
> I'm not loyal to any particular system. And I just like to learn how
> things work. I'm just a little bit confused about how this is supposed
> to work. Thanks for reading this and I'll play around with it a bit more
> myself and see if I can hack something up.

Generally, it is simply wrong to play music as root. Which is why we
don't really support it.

There are mostly two reasons why folks might want audio as root:

1) they do the full X login as root. This is just wrong. Everyone who
does this deserves having broken audio. If you want to switch to root
for admin purposes, do so temporarily, using sudo or a similar
tool. And certainly don't play any audio as root!

2) They want to run some system service that runs as root and which
wants to play some audio. This is often misguided. If you have a
system service running as root you already lost, you should run as its
own system user, not root. A good example how this is fixed properly
is gdm. The gdm login screen runs under its own gdm user which runs
its own PA instance, and everything is good.

So generally I believe playing audio back as root is just wrong. And
unless someone convinces me otherwise (very unlikely) I don't plan to
support it any better than we do right now.

Lennart

-- 
Lennart Poettering                        Red Hat, Inc.
lennart [at] poettering [dot] net
http://0pointer.net/lennart/           GnuPG 0x1A015CC4



More information about the pulseaudio-discuss mailing list