[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: permissions on /dev/dsp /dev/audio



Mark Elissen wrote:
-----BEGIN PGP SIGNED MESSAGE-----

I've just installed Debian 2.0 after using Slackware for some year of 3.
I'm very pleased with the "debian" way, but I have 1 minor problem:
Whenever I am using a program that outputs to /dev/audio or /dev/dsp as a
non-root user than the soundprogramm stops with the errormessage
"permission denied". How can I grant rights to this devices for non-root
users?

Mark.
 

I just went through this with Java.
It took me two weeks to figure it out hopefully you've already figured it out.
When I type
ls-l /dev/audio
crw-rw-rw-   1 root     audio     14,   4 May 27  1997 /dev/audio
  The owner is root, the group is audio
If this is not true as root type
chgrp /dev/audio audio
(but I don't think any debian installation would ever get that wrong)

I've taken the quick and dirty way out with a security hole, because anyone can read or
write to my audio device, my computer could literally be 'bugged' (as in audio listening device)
but I'm sure any such saboteur has long since died of boredom.  However anything can no use
the sound devices.

The proper way is to use the setuid or setgid bits of the various audioplayers
lets say you have an audio player utility /usr/bin/audioplay
you would want to have it 'join' the audio group
become the root and type
chgrp /usr/bin/audioplay audio
but you then need to set the group id bit, and audioplay will always run as a member of group audio
even if the user invoking audioplay is not.  Again as root
chmod g+s /usr/bin/audioplay
and now audioplay has access to the audio devices regardless of who's logged on.
I don't think this works on scripts (setuid doens't) so if audioplay was a script this doens't work
(find out the 'real' binary the script is invoking and use setgid on that)

Alternately YOU could join the audio group, that way you could use audio devices but other mortal users
could not (unless the root similarly grants them the ability) I don't know of a command line utility to add
users to groups, simply modify /etc/group (again as root); under default debian 1.3.1 there is a line
audio:x:29:
simply add your user name to make
audio:x:yourname
-Chip Grandits
 


Reply to: