# access to /dev/sound

## MrSandman666

Hi everybody...

I've been trying to install mpd (music player daemon) on my machine recently and it works fine, as long as it's running under the same uid as the currently logged in user...

If I start it via init.d script and tell it to start as some user and then log in as a different one and then try to use it it will simply tell me that it can't access /dev/sound. Which is true, since /dev/sound is always owned by whoever is currently logged in and is set to chmod 600, meaning only the user who owns it has read or write access...

generally, AFAIK, the concept goes that the thing should be owned by the user root and the group audio and be chmodded to 660, so that the user as well as the group have read and write access. How can this be accomplished? I already looked into the devfsd.conf and it's set up correctly but somehow it seems to get overriddden.

I know this is possible. It is working for other people, so why shouldn't it work for me? this seems to be an oddity of Gentoo, which is why I'm posting here....

Any help is greatly appreciated!

Thank you...

----------

## MrSandman666

Anything? Please? Doesn't anybody else have this problem? Or should I go to the multimedia forum?

----------

## shank

I have the same problem  :Smile: 

ALthough i don't reboot very frequently.

----------

## linkfromthepast

Change the group on /dev/sound to audio.  Add whichever user wants to use it to the group audio.  No chmod neccessary.  From what I understand only the user is changing for the ownership for /dev/sound?

Have you tried this and had problems?

----------

## MrSandman666

The group is already correctly associated, this is not the problem. The problem is that the devices are chmodded 600, meaning that only the owner and not the group gets access. I don't know why this is. Usually the group should be granted access as well. I can chmod it alright but that doesn't survive the next logout/login.

----------

## linkfromthepast

Have you checked all the scripts that set the session values?  

Have you checked in the config of the audio module/system you are using?  

Have you 'cd /; grep -R 'chmod 600' *' hehe  :Smile: 

----------

## linkfromthepast

Also, you might want to check the perms on /dev/snd:

```
crw-rw----    1 root     audio    116,   0 Dec 31  1969 /dev/snd/controlC0
```

----------

## MrSandman666

I've checked quite a few scripts that set session variables but probably not all since I don't know all of them. 

See, the thing is, for me the permission for my /dev/sound folder (or rather its contents) are set to

```

crw-------   1 sseeland audio     14,   3 Jan   1  1970 dsp

```

Of course the date and device name changes for every entry... I can do 'chmod 660 /dev/sound/*' and everything will work fine - until I log in as a different user.

----------

## MrSandman666

by the way: everything works beautifully until I log into X. when I log out of X and then use the console to chmod to 660 and then reboot the directory keeps the permissions through the reboot. Until I log into X again...

----------

## linkfromthepast

For me there is nothing in my /dev/sound folder.  All my devices are in /dev/snd.  Anyway, only thing I can think of is the modules running in user-space are being loaded/unloaded each time you login/logout which resets the permissions.  Sorry I can't be of anymore help w/o looking at your box.

BTW, I'm using alsa.

----------

## linkfromthepast

What window manager?

----------

## MrSandman666

I use Fvwm but it also happens when I log into Gnome/Metacity so I don't think it's the window manager. And it also happens when I log *out* of a current X session. So, when I'm not logged into X, run chmod, then log into X, the changes are lost. When I chmod again, the changes stay until I log out again.

----------

## MrSandman666

No ideas? I know others are using MPD on their Gentoo, so this has to be solveable! Any hints as to where I might look and what to look for? 

Thanks

----------

## blscreen

This is a feature of pam and can be controlled here:

In the file /etc/security/console.perms comment out the line

```
<console>  0600 <sound>      0600 root.audio
```

 or change it to

```
<console>  0600 <sound>      0660 root.audio
```

By commenting the line out, pam will not mess with your sound permissions at all. The second example will change the permissions to the user currently logged in, but will revert it to group read-writable and owned by root when this user loggs out again.

----------

## bargol

I had similar problems and solved them in the following way.

The problem is that every time a user logs in, the pam module pam_console is called and changes the permission accordingly to the user ('a user-friendly behaviour').

Start the root-setuided X afterwards the permissions of video, audio and other devices will be changed to root. So commenting out the pam_console line in /etc/pam.d/login helped.

I believe thats an unwanted behaviour and should get ripped of .

----------

