I've just spent the past few hours struggling to find a way to enable audio for multiple users at the same time (Fedora Core 5). I'm posting my solution in case anyone else wants to know how I did it. Also, I would love input from some linux guru out there that knows whether I'm doing something terrible to my system by doing it this way. (I'm very new to Linux.)
Motivation:
My wife and I both use the same computer, but we log in separately. I usually log in first, then she logs in by getting a new GUI terminal (using "System Tools --> New Login" in the gnome menus). Her terminal is on VT9 (Ctrl-Alt-F9), mine is on VT7 (Ctrl-Alt-F7). To my surprise, I found out quickly that only the first user to log in (usually me) can play audio!
Solution:
PART 1 - Permissions
First, I needed to change the default permissions on the sound devices. This can be done by editing the following line in "/etc/security/console.perms.d/50-default.perms". I used the following values:
Original <sound> line:
Code:
<console> 0600 <sound> 0600 root
My changes:
Code:
<console> 0660 <sound> 0660 root.sound
This means that anyone in the "sound" group can read and write to the various sound devices. ("/dev/snd", "/dev/mixer", etc.)
Next, I created a "sound" group and added all the users to that group that I wanted to be able to access the sound device. This means that both my wife and myself are now members of the "sound" group. So, we now have full read/write access to the various sound devices.
After rebooting, these two steps got me half-way there. At this point, both users can change the volume using the gnome volume control. However, only 1 user has the ability to actually play audios.
PART 2 - Console Locking
My next step was to figure out why only 1 user gets access to the sound system. After digging for a while, I discovered that the program "ainit" is the culprit. When the first user logs in, he obtains a console lock. This triggers the call to "ainit", which locks the alsa sound system for a specific user. The next user to log in tries to get a console lock, but can't, since the first user has it. Thus, "ainit" never gets called for the second user, and the alsa sound system continues to be locked for that user.
So, here's the sketchy part of my solution. I commented out the call to "ainit" when a new user obtains a console lock. (Somebody please tell me if this is a bad thing!) I commented out the following lines in "/etc/security/console.handlers":
Code:
#/usr/bin/ainit lock user start
#/usr/bin/ainit unlock user stop
That did it! When I rebooted, I was able to log in both users and play audio simultaneously. Hopefully, someone will be helped by this. But, please, I hope someone who truly knows linux will respond and let us all know if this is a valid solution. I'm really not sure if "ainit" does something important for me (it doesn't appear to make any difference).
Thanks!