How are permissions on /dev devices set at boot time?
Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How are permissions on /dev devices set at boot time?
Specifically I'm looking at devices like /dev/dsp, /dev/mixer, etc - all the sound devices. On boot they're set to 0660: after login the pam_console process changes them to 0666, as defined in /etc/security/console.perms.
I'd like to have them set to 0666 at boot time - *before* the first user logs in - so sound can be played using remote terminals. I think it might be pam_console that sets the original perms at boot time, but I can't figure out how from the man pages - or if I can change it.
for the moment I've thrown a 'chmod' command into /etc/X11/xdm/Xsetup_0 so that those files are all changed when X starts, but that's a hack: I'm looking for a more elegant solution.
Thanks, Dave, I looked at /etc/security/console.perms, but as I said in my initial update I want to modify permissions before the first user logs in.
Console.perms only takes effect after the first user logs in at the gui console. But there's definitely a mechanism that resets those permissions at boot time: I've tried rebooting the machine, ssh'ing in and changing the permissions, and then rebooting again without anyone ever logging in at the gui. The permissions revert to their original state.
The devices are created at boot, so you're getting the defaults for your sound devices. The permissions can be set in the udev rules.
On RedHat/Fedora, the sound device rules are in /etc/udev/rules.d/40-alsa.rules , but as the file says, it'll be overwritten on update.
Probably best to create a 99-my.rules in that directory to munge the permissions once the devices have been created (udev runs through all the files in there in numerical order). On my system, I'd use something like:
Haven't actually tried this, but I think it should work OK. If not, just edit the udev rule file that creates the devices, and add the ', MODE="0666"'.
Well, those are great suggestions... and they totally make sense, but they didn't quite work for me. I tried both creating a new file, /etc/udev/rules.d/99-sounddev.rules
Rebooted after each change, of course, and saw no changes. However, I did keep researching and found the solution: looking at /etc/udev/udev.conf I spied the following:
Quote:
# udev_permissions - The name and location of the udev permission file
udev_permissions="/etc/udev/permissions.d/"
# default_mode - set the default mode for all nodes that have no
# explicit match in the permissions file
default_mode="0600"
Ah-Ha! I took a look at /etc/udev/permissions.d/50-udev.permissions and found:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.