Why are /dev/sr0 permissions set to "root" and "optical" while /dev/cdrom are "root" and "root" ? Why the greater restrictions on /dev/cdrom ?
It is a symlink:
$ ls -l /dev/sr0 brw-rw----+ 1 root optical 11, 0 Feb 7 11:40 /dev/sr0
$ ls -l /dev/cdrom lrwxrwxrwx 1 root root 3 Feb 7 11:40 /dev/cdrom -> sr0
just different permissions.
Umm yeah, because it's a link to another file so when an application reads the symlimk it's actually reading /dev/sr0 including it's permissions.
Ok. I wasn't sure that /dev/cdrom would simply inherit the /dev/sr0 permissions: I mistakenly thought that you could make a link and set different permissions on the link.
Well I guess you could use chgrp on a symlink, but only to protect the symlink itself which is pointless here as it's root:root anyway, and why wouldn't you just use root:root on symlinks you don't want users to tamper with? If you do manage to think of an occasion where you need to change the ownership of symlinks you could use chgrp...
EDIT/ Doh even that is useless as you can't really protect symlinks as AFAIK permission will be set by parent directory...
Also, if the /dev/cdrom symlink did manage to disappear it would just be recreated on the next boot by systemd/udev!
Last edited by Meyithi (2013-02-07 19:02:00)