lkml.org 
[lkml]   [1998]   [Aug]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: DEVFS and permissions/group/owner
Erik Andersen writes:
>
> On Fri, 7 Aug 1998, Richard Gooch wrote:
>
> A quick question. devfs always creates device special files with
> some default permissions (presumable root, root, 400(?)), and to
> make these into something sane (i.e. changing group to cdrom or floppy,
> for instance, or setting permissions to maybe 444), you use a tar file
> to save/restore these attributes across mountings.

The default permissions are up to the individual driver.

> My question is, how is this permission/owner/group adjustment to be handled
> for dynamically created devices such as USB stuff, or module loaded drivers?
> Must you have a cron job that polls for the existance of a particular device
> and then updates its permissions when the device comes into existance? I
> can imagine that (at least with a module like cdrom) you could add a post-
> install method to your conf.modules file. Unfortunatly though, this method
> has its own problems (i.e. dynamic loading I presume wouldn't work becasue
> the device file doesn't exist yet to inform the kernel that the device needs
> loading -- and the permissions are wrong for typical users to access them
> anyway because the cron job hasn't updated the not-yet-existing
> device file).

What you can do right now is to mknod(2) entries which have to have
different permissions. Later, when the driver registers the new
device, the connection is made between the driver and the device
node. The down side to this is that you get the device entry in /dev
before the device is actually available.

> I would presume these problems are the same or worse for hot pluggable
> devices.

Not so much worse, rather more of the same.

> Wouldn't it be better to have some sort of a daemon (like kmod for example)
> who checks a file in user-space (i.e. /etc/dev_permsissions ) and whenever
> devfs adds a device (after the root filesystem is mounted) it sets the
> permissions/owner/group of the device if it has an entry in this special
> file. It would have to have special treatment of dev files that are
> created before / is mounted and the daemon started, but this is certainly
> doable and avoids the "ugly-hack" arguments we have been hearing. It doesn't
> fix my dynamic module loading concern -- but then I could be way off here...

This is touching on something I've been considering, and I think it
would be really neat. Basically, devfs can notify some daemon whenever
a new device entry is created. You can hook anything onto that.
You can set device permissions, start scripts, mount devices, fire up
a GUI, anything.
For the permissions bit, you could have a regular expression table of
premissions (assuming the driver defaults are not what you want), so
that you can do things like:

# /etc/devfsd.conf
PERMISSIONS usb/* root.usbusers rw-rw----
PERMISSIONS usb/block/* root.root 0600
SCRIPT usb/block/* /usr/sbin/my-cool-mount

The possibilities are endless.

Regards,

Richard....

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html

\
 
 \ /
  Last update: 2005-03-22 13:43    [W:0.094 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site