Ok, I see some possibilities:
The quickest way, the whole point of POSIX permissions and ownership: you want someone to be able to read and/or write, you set the permissions accordingly. Just put these people in a group and change the device ownership to that group, giving the group write permissions. You may have to put this in udev
rules, if your /dev
is managed by udev
.
This is what some tools do, for example bluez does it to enable users to use bluetooth, or at least that's the method used in my distro unless I try to use "ConsoleKit".
If the device is simple and there's no problem in having it used to everyone, just allow everyone to write on it.
Write a daemon that starts as some user that can write on the device, grabs the device and drops its privileges by changing its UID and then processes requests from any user through, for example, TCP.
Write a small binary to write for the device, that is setuid
some user that can write on the device and have users use it to write to the device. That's what mount
does, it is setuid
root, so that regular users can mount filesystems if /etc/fstab
allows them to do so.
It does not create any additional security concerns, as far as you're ok with these users being able to use that device. Of course that anyone with access to the device may exploit any vulnerability in the module, but that would be possible no matter how you give people access to it. If you write a daemon, that can be exploited. Maybe it is better keep things simple and make sure your code is not vulnerable.
I'd say there is no single standard way to do this — there are some ways parts of UNIX systems do this, and each part does it in the most convenient way for the kind of problem being solved.