* udev - TODO update
@ 2004-02-12 23:45 Kay Sievers
2004-02-13 1:26 ` Greg KH
` (39 more replies)
0 siblings, 40 replies; 41+ messages in thread
From: Kay Sievers @ 2004-02-12 23:45 UTC (permalink / raw)
To: linux-hotplug
Here a few questions about my favorite file in the tree :)
- better partition support (it's a hack right now, maybe new libsysfs changes
can help out a lot here.)
It's done with Ananth's patches, right?
- option to always add all partitions. This is needed to properly handle
devices with removable media.
Sounds soooo... ugly, but seems we should do it. Any idea which direction?
- allow database to be queried by other programs
Is udevinfo enough, or do we need something more?
- split program into two pieces (daemon and helper that sends events to it).
This will allow us to keep track of sequences, and lots of other needed
stuff.
It's done, I think :)
- keep track of current permissions on devices when daemon shuts down.
Hmm, what is this?
- better permission handling
What is missing here?
thanks,
Kay
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: udev - TODO update
2004-02-12 23:45 udev - TODO update Kay Sievers
@ 2004-02-13 1:26 ` Greg KH
2004-02-13 1:59 ` Kay Sievers
` (38 subsequent siblings)
39 siblings, 0 replies; 41+ messages in thread
From: Greg KH @ 2004-02-13 1:26 UTC (permalink / raw)
To: linux-hotplug
On Fri, Feb 13, 2004 at 12:45:38AM +0100, Kay Sievers wrote:
>
> Here a few questions about my favorite file in the tree :)
>
>
> - better partition support (it's a hack right now, maybe new libsysfs changes
> can help out a lot here.)
>
> It's done with Ananth's patches, right?
I think so, yes.
> - option to always add all partitions. This is needed to properly handle
> devices with removable media.
>
> Sounds soooo... ugly, but seems we should do it. Any idea which direction?
I think a config option. If set, we ignore the partition devices, and
just create every possible partition when we see the "main" block
device. This is needed for removable media devices.
I agree it is ugly, but if anyone else can come up with an idea?
> - allow database to be queried by other programs
>
> Is udevinfo enough, or do we need something more?
I think udevinfo is enough for now. Anyone else feel a need for more?
> - split program into two pieces (daemon and helper that sends events to it).
> This will allow us to keep track of sequences, and lots of other needed
> stuff.
>
> It's done, I think :)
Heh, yes, thanks a lot.
> - keep track of current permissions on devices when daemon shuts down.
>
> Hmm, what is this?
When the /etc/init.d/udev script shuts down we need to save any
permission changes that have been done to the device nodes. That way a
user can do:
chmod 666 /dev/ttyUSB1
and we will pick this change up the next time we boot up.
Perhaps just a wrapper script:
udevinfo chmod 666 /dev/ttyUSB1
that could also catch the change and write it to the permissions file.
But I don't think people will really go for that one.
It would be good to see how Gentoo handles this as I think they tar up
everything right now on system shutdown. I'm trying to install it on a
spare laptop and stuck in build hell right now, so it will probably be a
few days...
> - better permission handling
>
> What is missing here?
I don't know for sure. Just a vague feeling that the way we currently
handle permissions is pretty lousy. Anyone else feel this way too?
thanks,
greg k-h
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: udev - TODO update
2004-02-12 23:45 udev - TODO update Kay Sievers
2004-02-13 1:26 ` Greg KH
@ 2004-02-13 1:59 ` Kay Sievers
2004-02-13 6:16 ` Daniel Drake
` (37 subsequent siblings)
39 siblings, 0 replies; 41+ messages in thread
From: Kay Sievers @ 2004-02-13 1:59 UTC (permalink / raw)
To: linux-hotplug
On Thu, Feb 12, 2004 at 05:26:37PM -0800, Greg KH wrote:
> On Fri, Feb 13, 2004 at 12:45:38AM +0100, Kay Sievers wrote:
> >
> > Here a few questions about my favorite file in the tree :)
> >
> > - option to always add all partitions. This is needed to properly handle
> > devices with removable media.
> >
> > Sounds soooo... ugly, but seems we should do it. Any idea which direction?
>
> I think a config option. If set, we ignore the partition devices, and
> just create every possible partition when we see the "main" block
> device. This is needed for removable media devices.
>
> I agree it is ugly, but if anyone else can come up with an idea?
I don't expect a better idea :)
I will try someting during the next few days.
> > - keep track of current permissions on devices when daemon shuts down.
> >
> > Hmm, what is this?
>
> When the /etc/init.d/udev script shuts down we need to save any
> permission changes that have been done to the device nodes. That way a
> user can do:
> chmod 666 /dev/ttyUSB1
> and we will pick this change up the next time we boot up.
Sounds a bit fragile and is it really needed?
We can't preserve the node permissions on simple device disconnect/connect
cycle this way, but want to do it during reboot?
thanks,
Kay
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: udev - TODO update
2004-02-12 23:45 udev - TODO update Kay Sievers
2004-02-13 1:26 ` Greg KH
2004-02-13 1:59 ` Kay Sievers
@ 2004-02-13 6:16 ` Daniel Drake
2004-02-13 8:31 ` Olaf Hering
` (36 subsequent siblings)
39 siblings, 0 replies; 41+ messages in thread
From: Daniel Drake @ 2004-02-13 6:16 UTC (permalink / raw)
To: linux-hotplug
Hi,
Greg KH wrote:
> It would be good to see how Gentoo handles this as I think they tar up
> everything right now on system shutdown. I'm trying to install it on a
> spare laptop and stuck in build hell right now, so it will probably be a
> few days...
Yes, the default behaviour creates a devices.tar.bz2 on shutdown and restores
it on bootup. As far as I understand it, thats only a temporary thing,
implemented before udev was creating so many nodes by default.
There is some discussion here to remove this behaviour,
http://bugs.gentoo.org/show_bug.cgi?id8587
There's also a forum thread kicking about, suggesting that people comment out
the lines causing the creation/restoration of the devices.tar.bz2 file. Thats
how I run and and its working great (as long as i modprobe nvidia before
starting X..)
Daniel
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: udev - TODO update
2004-02-12 23:45 udev - TODO update Kay Sievers
` (2 preceding siblings ...)
2004-02-13 6:16 ` Daniel Drake
@ 2004-02-13 8:31 ` Olaf Hering
2004-02-13 17:52 ` Mike Frysinger
` (35 subsequent siblings)
39 siblings, 0 replies; 41+ messages in thread
From: Olaf Hering @ 2004-02-13 8:31 UTC (permalink / raw)
To: linux-hotplug
On Fri, Feb 13, Kay Sievers wrote:
> On Thu, Feb 12, 2004 at 05:26:37PM -0800, Greg KH wrote:
> > On Fri, Feb 13, 2004 at 12:45:38AM +0100, Kay Sievers wrote:
> > >
> > > Here a few questions about my favorite file in the tree :)
> > >
> > > - option to always add all partitions. This is needed to properly handle
> > > devices with removable media.
> > >
> > > Sounds soooo... ugly, but seems we should do it. Any idea which direction?
> >
> > I think a config option. If set, we ignore the partition devices, and
> > just create every possible partition when we see the "main" block
> > device. This is needed for removable media devices.
> >
> > I agree it is ugly, but if anyone else can come up with an idea?
>
> I don't expect a better idea :)
> I will try someting during the next few days.
Oh my!
Implement a sane polling method for the devices who need it.
--
USB is for mice, FireWire is for men!
sUse lINUX ag, n√úRNBERG
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: udev - TODO update
2004-02-12 23:45 udev - TODO update Kay Sievers
` (3 preceding siblings ...)
2004-02-13 8:31 ` Olaf Hering
@ 2004-02-13 17:52 ` Mike Frysinger
2004-02-13 19:34 ` Daniel Stekloff
` (34 subsequent siblings)
39 siblings, 0 replies; 41+ messages in thread
From: Mike Frysinger @ 2004-02-13 17:52 UTC (permalink / raw)
To: linux-hotplug
[-- Attachment #1: Type: text/plain, Size: 1051 bytes --]
On Friday 13 February 2004 01:16 am, Daniel Drake wrote:
> Yes, the default behaviour creates a devices.tar.bz2 on shutdown and
> restores it on bootup. As far as I understand it, thats only a temporary
> thing, implemented before udev was creating so many nodes by default.
>
> There is some discussion here to remove this behaviour,
> http://bugs.gentoo.org/show_bug.cgi?id=38587
i've stopped doing this on my boxes just to see how far along udev has come
(and boy, it's almost there for everything i need it for :D) ...
i noticed that on my machines that use framebuffer devices, fbX wasnt being
created, and on my ppc laptop, some adb related-nodes werent being created,
so the way i've worked around it is to change the init scripts to
run /etc/udev/udev.local instead of untaring the devices.tar.bz2 ... this
script just creates a bunch of machine specific nodes via mknod and sets
their perms correctly
i'm just glad udev is arch independent so i havent been forced back into devfs
on some of my machine ;)
-mike
[-- Attachment #2: signature --]
[-- Type: application/pgp-signature, Size: 827 bytes --]
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: udev - TODO update
2004-02-12 23:45 udev - TODO update Kay Sievers
` (4 preceding siblings ...)
2004-02-13 17:52 ` Mike Frysinger
@ 2004-02-13 19:34 ` Daniel Stekloff
2004-02-13 22:53 ` Greg KH
` (33 subsequent siblings)
39 siblings, 0 replies; 41+ messages in thread
From: Daniel Stekloff @ 2004-02-13 19:34 UTC (permalink / raw)
To: linux-hotplug
On Thursday 12 February 2004 05:26 pm, Greg KH wrote:
> On Fri, Feb 13, 2004 at 12:45:38AM +0100, Kay Sievers wrote:
> > - allow database to be queried by other programs
> >
> > Is udevinfo enough, or do we need something more?
>
> I think udevinfo is enough for now. Anyone else feel a need for more?
The original intent for querying udev's db was:
1) API for applications to query what devices were currently configured on the
system. This really shouldn't be done within udev, but could be done
externally hooking into udev through callout or DBUS events.
2) API for querying a device's name and its node, or the other way around.
This too could be done externally to udev. Or, it may not be needed at all.
Either way, I think udevinfo is good enough for now.
Thanks,
Dan
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&opÌk
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: udev - TODO update
2004-02-12 23:45 udev - TODO update Kay Sievers
` (5 preceding siblings ...)
2004-02-13 19:34 ` Daniel Stekloff
@ 2004-02-13 22:53 ` Greg KH
2004-02-17 1:41 ` Greg KH
` (32 subsequent siblings)
39 siblings, 0 replies; 41+ messages in thread
From: Greg KH @ 2004-02-13 22:53 UTC (permalink / raw)
To: linux-hotplug
On Fri, Feb 13, 2004 at 02:59:26AM +0100, Kay Sievers wrote:
> > > - keep track of current permissions on devices when daemon shuts down.
> > >
> > > Hmm, what is this?
> >
> > When the /etc/init.d/udev script shuts down we need to save any
> > permission changes that have been done to the device nodes. That way a
> > user can do:
> > chmod 666 /dev/ttyUSB1
> > and we will pick this change up the next time we boot up.
>
> Sounds a bit fragile and is it really needed?
I don't really know, but some people thought it was a long time ago.
> We can't preserve the node permissions on simple device
> disconnect/connect cycle this way, but want to do it during reboot?
Maybe we should do something on disconnect?
Anyone really want this?
thanks,
greg k-h
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: udev - TODO update
2004-02-12 23:45 udev - TODO update Kay Sievers
` (6 preceding siblings ...)
2004-02-13 22:53 ` Greg KH
@ 2004-02-17 1:41 ` Greg KH
2004-02-17 1:48 ` Mike Frysinger
` (31 subsequent siblings)
39 siblings, 0 replies; 41+ messages in thread
From: Greg KH @ 2004-02-17 1:41 UTC (permalink / raw)
To: linux-hotplug
On Fri, Feb 13, 2004 at 12:52:18PM -0500, Mike Frysinger wrote:
> On Friday 13 February 2004 01:16 am, Daniel Drake wrote:
> > Yes, the default behaviour creates a devices.tar.bz2 on shutdown and
> > restores it on bootup. As far as I understand it, thats only a temporary
> > thing, implemented before udev was creating so many nodes by default.
> >
> > There is some discussion here to remove this behaviour,
> > http://bugs.gentoo.org/show_bug.cgi?id8587
>
> i've stopped doing this on my boxes just to see how far along udev has come
> (and boy, it's almost there for everything i need it for :D) ...
>
> i noticed that on my machines that use framebuffer devices, fbX wasnt being
> created, and on my ppc laptop, some adb related-nodes werent being created,
> so the way i've worked around it is to change the init scripts to
> run /etc/udev/udev.local instead of untaring the devices.tar.bz2 ... this
> script just creates a bunch of machine specific nodes via mknod and sets
> their perms correctly
Where is the startup script in gentoo that does this? I couldn't seem
to find it.
But I was able to blow away my whole /dev directory and reboot and have
udev create all of the nodes that I needed to startup. That was
impressive. Hm, Gentoo seems kinda nice now... :)
> i'm just glad udev is arch independent so i havent been forced back
> into devfs on some of my machine ;)
If udev ever gets any non-arch-independant code, please let me know, I
do not want this to happen.
thanks,
greg k-h
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: udev - TODO update
2004-02-12 23:45 udev - TODO update Kay Sievers
` (7 preceding siblings ...)
2004-02-17 1:41 ` Greg KH
@ 2004-02-17 1:48 ` Mike Frysinger
2004-02-27 0:41 ` Kay Sievers
` (30 subsequent siblings)
39 siblings, 0 replies; 41+ messages in thread
From: Mike Frysinger @ 2004-02-17 1:48 UTC (permalink / raw)
To: linux-hotplug
[-- Attachment #1: Type: text/plain, Size: 748 bytes --]
On Monday 16 February 2004 08:41 pm, Greg KH wrote:
> Where is the startup script in gentoo that does this? I couldn't seem
> to find it.
/sbin/rc
search for 'udev-state' and you should find it ...
> But I was able to blow away my whole /dev directory and reboot and have
> udev create all of the nodes that I needed to startup. That was
> impressive. Hm, Gentoo seems kinda nice now... :)
one of the very reasons i'll probably never leave Gentoo ... no other
distrubition lets you use the _very latest_ tools so easily :)
> If udev ever gets any non-arch-independant code, please let me know, I
> do not want this to happen.
i'll keep that in mind ... for now i'll just keep bugging you with gcc-2.x
patches ;)
-mike
[-- Attachment #2: signature --]
[-- Type: application/pgp-signature, Size: 827 bytes --]
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: udev - TODO update
2004-02-12 23:45 udev - TODO update Kay Sievers
` (8 preceding siblings ...)
2004-02-17 1:48 ` Mike Frysinger
@ 2004-02-27 0:41 ` Kay Sievers
2004-02-27 0:49 ` Robert Love
` (29 subsequent siblings)
39 siblings, 0 replies; 41+ messages in thread
From: Kay Sievers @ 2004-02-27 0:41 UTC (permalink / raw)
To: linux-hotplug
[-- Attachment #1: Type: text/plain, Size: 558 bytes --]
On Thu, Feb 12, 2004 at 05:26:37PM -0800, Greg KH wrote:
> On Fri, Feb 13, 2004 at 12:45:38AM +0100, Kay Sievers wrote:
> >
> > Here a few questions about my favorite file in the tree :)
> > - better permission handling
> >
> > What is missing here?
>
> I don't know for sure. Just a vague feeling that the way we currently
> handle permissions is pretty lousy. Anyone else feel this way too?
Seems that nobody cares and perhaps the recent klibc permission changes
and the multiple file config directory are enough to kill these lines? :)
thanks,
Kay
[-- Attachment #2: 03-TODO.patch --]
[-- Type: text/plain, Size: 592 bytes --]
===== TODO 1.16 vs edited =====
--- 1.16/TODO Fri Feb 20 02:06:41 2004
+++ edited/TODO Fri Feb 27 01:19:08 2004
@@ -10,8 +10,6 @@
- install the proper init.d script based on the distro we are running on.
- persuade the distro packagers to submit their changes (or just steal them
if we can find them...)
-- keep track of current permissions on devices when daemon shuts down.
-- better permission handling
- create kernel name to devfs name config file so that all of the devfs users
will have an upgrade path.
- do early boot logic (putting udev into initramfs, handle pivot-root,
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: udev - TODO update
2004-02-12 23:45 udev - TODO update Kay Sievers
` (9 preceding siblings ...)
2004-02-27 0:41 ` Kay Sievers
@ 2004-02-27 0:49 ` Robert Love
2004-02-27 1:00 ` Greg KH
` (28 subsequent siblings)
39 siblings, 0 replies; 41+ messages in thread
From: Robert Love @ 2004-02-27 0:49 UTC (permalink / raw)
To: linux-hotplug
On Thu, 2004-02-26 at 19:41, Kay Sievers wrote:
> Seems that nobody cares and perhaps the recent klibc permission changes
> and the multiple file config directory are enough to kill these lines? :)
One thing I would like is the ability to put an identifier in the config
file, say $local, and have the device node's permission set to that of
the current local user.
Robert Love
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: udev - TODO update
2004-02-12 23:45 udev - TODO update Kay Sievers
` (10 preceding siblings ...)
2004-02-27 0:49 ` Robert Love
@ 2004-02-27 1:00 ` Greg KH
2004-02-27 1:13 ` Mike Frysinger
` (27 subsequent siblings)
39 siblings, 0 replies; 41+ messages in thread
From: Greg KH @ 2004-02-27 1:00 UTC (permalink / raw)
To: linux-hotplug
On Thu, Feb 26, 2004 at 07:49:22PM -0500, Robert Love wrote:
> On Thu, 2004-02-26 at 19:41, Kay Sievers wrote:
>
> > Seems that nobody cares and perhaps the recent klibc permission changes
> > and the multiple file config directory are enough to kill these lines? :)
>
> One thing I would like is the ability to put an identifier in the config
> file, say $local, and have the device node's permission set to that of
> the current local user.
And how does a program determine the "current local user"?
thanks,
greg k-h
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: udev - TODO update
2004-02-12 23:45 udev - TODO update Kay Sievers
` (11 preceding siblings ...)
2004-02-27 1:00 ` Greg KH
@ 2004-02-27 1:13 ` Mike Frysinger
2004-02-27 1:23 ` Mike Waychison
` (26 subsequent siblings)
39 siblings, 0 replies; 41+ messages in thread
From: Mike Frysinger @ 2004-02-27 1:13 UTC (permalink / raw)
To: linux-hotplug
[-- Attachment #1: Type: text/plain, Size: 750 bytes --]
On Thursday 26 February 2004 08:00 pm, Greg KH wrote:
> On Thu, Feb 26, 2004 at 07:49:22PM -0500, Robert Love wrote:
> > On Thu, 2004-02-26 at 19:41, Kay Sievers wrote:
> > > Seems that nobody cares and perhaps the recent klibc permission changes
> > > and the multiple file config directory are enough to kill these lines?
> > > :)
> >
> > One thing I would like is the ability to put an identifier in the config
> > file, say $local, and have the device node's permission set to that of
> > the current local user.
>
> And how does a program determine the "current local user"?
seems more like the domain of pam or similar authentication services ... once
a 'local' user has logged in, the permissions are setup accordingly
-mike
[-- Attachment #2: signature --]
[-- Type: application/pgp-signature, Size: 827 bytes --]
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: udev - TODO update
2004-02-12 23:45 udev - TODO update Kay Sievers
` (12 preceding siblings ...)
2004-02-27 1:13 ` Mike Frysinger
@ 2004-02-27 1:23 ` Mike Waychison
2004-02-27 1:27 ` Robert Love
` (25 subsequent siblings)
39 siblings, 0 replies; 41+ messages in thread
From: Mike Waychison @ 2004-02-27 1:23 UTC (permalink / raw)
To: linux-hotplug
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Greg KH wrote:
| On Thu, Feb 26, 2004 at 07:49:22PM -0500, Robert Love wrote:
|
|>On Thu, 2004-02-26 at 19:41, Kay Sievers wrote:
|>
|>
|>>Seems that nobody cares and perhaps the recent klibc permission changes
|>>and the multiple file config directory are enough to kill these lines? :)
|>
|>One thing I would like is the ability to put an identifier in the config
|>file, say $local, and have the device node's permission set to that of
|>the current local user.
|
|
| And how does a program determine the "current local user"?
|
How about:
w | awk '$2=":0" {print $1}'
? Maybe even better would be $TTY{:0} ?
- --
Mike Waychison
Sun Microsystems, Inc.
1 (650) 352-5299 voice
1 (416) 202-8336 voice
mailto: Michael.Waychison@Sun.COM
http://www.sun.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NOTICE: The opinions expressed in this email are held by me,
and may not represent the views of Sun Microsystems, Inc.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFAPpwgdQs4kOxk3/MRArHBAJ9IpVu1wmaVSFieJS3Q2UHo887SzgCfTTR4
Z2F92AW28iqxpqA3fkfKs98=qJ90
-----END PGP SIGNATURE-----
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: udev - TODO update
2004-02-12 23:45 udev - TODO update Kay Sievers
` (13 preceding siblings ...)
2004-02-27 1:23 ` Mike Waychison
@ 2004-02-27 1:27 ` Robert Love
2004-02-27 1:36 ` Robert Love
` (24 subsequent siblings)
39 siblings, 0 replies; 41+ messages in thread
From: Robert Love @ 2004-02-27 1:27 UTC (permalink / raw)
To: linux-hotplug
On Thu, 2004-02-26 at 20:00, Greg KH wrote:
> And how does a program determine the "current local user"?
utmp.
Robert Love
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: udev - TODO update
2004-02-12 23:45 udev - TODO update Kay Sievers
` (14 preceding siblings ...)
2004-02-27 1:27 ` Robert Love
@ 2004-02-27 1:36 ` Robert Love
2004-02-27 2:24 ` Bill Nottingham
` (23 subsequent siblings)
39 siblings, 0 replies; 41+ messages in thread
From: Robert Love @ 2004-02-27 1:36 UTC (permalink / raw)
To: linux-hotplug
[-- Attachment #1: Type: text/plain, Size: 474 bytes --]
On Thu, 2004-02-26 at 20:27, Robert Love wrote:
> On Thu, 2004-02-26 at 20:00, Greg KH wrote:
>
> > And how does a program determine the "current local user"?
>
> utmp.
Here is an example. Just stick this code where we do the chmod(), and
invoke it if the user is $local or whatever.
The purpose being we want certain devices to be owned by the local
user. Obviously we also need to do some stuff on login/logout, but
consolehelper will do that for us.
Robert Love
[-- Attachment #2: local.c --]
[-- Type: text/x-csrc, Size: 591 bytes --]
/*
* detect the local user
*
* rml@ximian.com
*/
#include <stdio.h>
#include <string.h>
#include <utmp.h>
int main()
{
struct utmp *u;
char user[UT_NAMESIZE] = "root";
time_t recent = 0;
setutent();
while ((u = getutent())) {
/* is this a user login ? */
if (u->ut_type != USER_PROCESS)
continue;
/* XXX: should probably check if the pid is stale */
/* is this a local login ? */
if (strcmp(u->ut_host, ""))
continue;
if (u->ut_time > recent) {
recent = u->ut_time;
strcpy(user, u->ut_user);
}
}
endutent();
printf("%s\n", user);
return 0;
}
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: udev - TODO update
2004-02-12 23:45 udev - TODO update Kay Sievers
` (15 preceding siblings ...)
2004-02-27 1:36 ` Robert Love
@ 2004-02-27 2:24 ` Bill Nottingham
2004-02-27 11:03 ` Robert McMeekin
` (22 subsequent siblings)
39 siblings, 0 replies; 41+ messages in thread
From: Bill Nottingham @ 2004-02-27 2:24 UTC (permalink / raw)
To: linux-hotplug
Robert Love (rml@tech9.net) said:
> Here is an example. Just stick this code where we do the chmod(), and
> invoke it if the user is $local or whatever.
>
> The purpose being we want certain devices to be owned by the local
> user. Obviously we also need to do some stuff on login/logout, but
> consolehelper will do that for us.
Although, if you're using pam_console, you can certainly key off
the same keys it's using, yes?
Bill
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: udev - TODO update
2004-02-12 23:45 udev - TODO update Kay Sievers
` (16 preceding siblings ...)
2004-02-27 2:24 ` Bill Nottingham
@ 2004-02-27 11:03 ` Robert McMeekin
2004-02-27 15:45 ` Kay Sievers
` (21 subsequent siblings)
39 siblings, 0 replies; 41+ messages in thread
From: Robert McMeekin @ 2004-02-27 11:03 UTC (permalink / raw)
To: linux-hotplug
On Thu, 2004-02-26 at 19:49, Robert Love wrote:
> One thing I would like is the ability to put an identifier in the
> config file, say $local, and have the device node's permission set to
> that of the current local user.
In devfsd.conf you were able to put a '-1' in for the for the current
local user when setting PERMISSIONS, and it worked great [1]. I wonder
what people used this for though.
[1] I originally used it to make $local.wheel own pts/*, so that the
wheel group could steal away other people's screens from their xterms (I
should have just added the trusted users to the tty group though, I
guess).
--
Robert McMeekin <rrm3@rrm3.org>
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: udev - TODO update
2004-02-12 23:45 udev - TODO update Kay Sievers
` (17 preceding siblings ...)
2004-02-27 11:03 ` Robert McMeekin
@ 2004-02-27 15:45 ` Kay Sievers
2004-02-27 17:35 ` Greg KH
` (20 subsequent siblings)
39 siblings, 0 replies; 41+ messages in thread
From: Kay Sievers @ 2004-02-27 15:45 UTC (permalink / raw)
To: linux-hotplug
On Fri, 2004-02-27 at 12:03, Robert McMeekin wrote:
> On Thu, 2004-02-26 at 19:49, Robert Love wrote:
>
> > One thing I would like is the ability to put an identifier in the
> > config file, say $local, and have the device node's permission set to
> > that of the current local user.
>
> In devfsd.conf you were able to put a '-1' in for the for the current
> local user when setting PERMISSIONS, and it worked great [1]. I wonder
> what people used this for though.
Are you really sure?
A -1 as the uid or gid means, that it shouldn't changed when chmod() is
called. I don't think, that it means anything like a local user.
Kay
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: udev - TODO update
2004-02-12 23:45 udev - TODO update Kay Sievers
` (18 preceding siblings ...)
2004-02-27 15:45 ` Kay Sievers
@ 2004-02-27 17:35 ` Greg KH
2004-02-27 17:37 ` Greg KH
` (19 subsequent siblings)
39 siblings, 0 replies; 41+ messages in thread
From: Greg KH @ 2004-02-27 17:35 UTC (permalink / raw)
To: linux-hotplug
On Thu, Feb 26, 2004 at 08:23:44PM -0500, Mike Waychison wrote:
> Greg KH wrote:
> | On Thu, Feb 26, 2004 at 07:49:22PM -0500, Robert Love wrote:
> |
> |>On Thu, 2004-02-26 at 19:41, Kay Sievers wrote:
> |>
> |>
> |>>Seems that nobody cares and perhaps the recent klibc permission changes
> |>>and the multiple file config directory are enough to kill these lines? :)
> |>
> |>One thing I would like is the ability to put an identifier in the config
> |>file, say $local, and have the device node's permission set to that of
> |>the current local user.
> |
> |
> | And how does a program determine the "current local user"?
> |
>
> How about:
>
> w | awk '$2=":0" {print $1}'
Sure doesn't work for me on any of my boxes.
And remember, udev doesn't want to have to call w and awk :)
thanks,
greg k-h
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: udev - TODO update
2004-02-12 23:45 udev - TODO update Kay Sievers
` (19 preceding siblings ...)
2004-02-27 17:35 ` Greg KH
@ 2004-02-27 17:37 ` Greg KH
2004-02-27 18:08 ` Mike Waychison
` (18 subsequent siblings)
39 siblings, 0 replies; 41+ messages in thread
From: Greg KH @ 2004-02-27 17:37 UTC (permalink / raw)
To: linux-hotplug
On Thu, Feb 26, 2004 at 08:36:38PM -0500, Robert Love wrote:
> On Thu, 2004-02-26 at 20:27, Robert Love wrote:
> > On Thu, 2004-02-26 at 20:00, Greg KH wrote:
> >
> > > And how does a program determine the "current local user"?
> >
> > utmp.
>
> Here is an example. Just stick this code where we do the chmod(), and
> invoke it if the user is $local or whatever.
Oh come on. You are so close to actually writing a patch that we can
use for udev that it's not even funny :)
Care to?
> The purpose being we want certain devices to be owned by the local
> user. Obviously we also need to do some stuff on login/logout, but
> consolehelper will do that for us.
Oh I agree it's something that distros will want to use. And how does
pam come into play here? Doesn't it allow us to do some of this for us?
thanks,
greg k-h
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: udev - TODO update
2004-02-12 23:45 udev - TODO update Kay Sievers
` (20 preceding siblings ...)
2004-02-27 17:37 ` Greg KH
@ 2004-02-27 18:08 ` Mike Waychison
2004-02-27 19:10 ` Bill Nottingham
` (17 subsequent siblings)
39 siblings, 0 replies; 41+ messages in thread
From: Mike Waychison @ 2004-02-27 18:08 UTC (permalink / raw)
To: linux-hotplug
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Greg KH wrote:
| On Thu, Feb 26, 2004 at 08:23:44PM -0500, Mike Waychison wrote:
|
|>Greg KH wrote:
|>| On Thu, Feb 26, 2004 at 07:49:22PM -0500, Robert Love wrote:
|>|
|>|>On Thu, 2004-02-26 at 19:41, Kay Sievers wrote:
|>|>
|>|>
|>|>>Seems that nobody cares and perhaps the recent klibc permission changes
|>|>>and the multiple file config directory are enough to kill these
lines? :)
|>|>
|>|>One thing I would like is the ability to put an identifier in the config
|>|>file, say $local, and have the device node's permission set to that of
|>|>the current local user.
|>|
|>|
|>| And how does a program determine the "current local user"?
|>|
|>
|>How about:
|>
|>w | awk '$2=":0" {print $1}'
|
|
| Sure doesn't work for me on any of my boxes.
|
Hmm, maybe we have different procps versions (2.0.13 here). Either way,
this is a variation on the utmp approach.
| And remember, udev doesn't want to have to call w and awk :)
Understood, this could be done some other way just as easily as Robert
Love demonstrated :)
I thought the /usr/* thing was solely an early initscript limitation. I
guess it's also a limitation on embedded platforms (who wouldn't use
$local anyway).
- --
Mike Waychison
Sun Microsystems, Inc.
1 (650) 352-5299 voice
1 (416) 202-8336 voice
mailto: Michael.Waychison@Sun.COM
http://www.sun.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NOTICE: The opinions expressed in this email are held by me,
and may not represent the views of Sun Microsystems, Inc.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFAP4eYdQs4kOxk3/MRAtjgAJ9vek2K4QTAacgfkKzL8KG5aiIavACfTRIU
mx2MEyoeNkEDtjdic3kFBd0=Gj6V
-----END PGP SIGNATURE-----
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: udev - TODO update
2004-02-12 23:45 udev - TODO update Kay Sievers
` (21 preceding siblings ...)
2004-02-27 18:08 ` Mike Waychison
@ 2004-02-27 19:10 ` Bill Nottingham
2004-02-27 19:19 ` Robert Love
` (16 subsequent siblings)
39 siblings, 0 replies; 41+ messages in thread
From: Bill Nottingham @ 2004-02-27 19:10 UTC (permalink / raw)
To: linux-hotplug
Greg KH (greg@kroah.com) said:
> > The purpose being we want certain devices to be owned by the local
> > user. Obviously we also need to do some stuff on login/logout, but
> > consolehelper will do that for us.
>
> Oh I agree it's something that distros will want to use. And how does
> pam come into play here? Doesn't it allow us to do some of this for us?
The pam_console module RH ships does this, based on a config file that
has device names in it. Obviously, the fact that the config file
lists device names could run afoul of udev.
As for logout, udev removing the device node does avoid the chmod
problem. Of course, we need revoke() to really do it right... :)
Bill
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: udev - TODO update
2004-02-12 23:45 udev - TODO update Kay Sievers
` (22 preceding siblings ...)
2004-02-27 19:10 ` Bill Nottingham
@ 2004-02-27 19:19 ` Robert Love
2004-02-27 19:20 ` Robert Love
` (15 subsequent siblings)
39 siblings, 0 replies; 41+ messages in thread
From: Robert Love @ 2004-02-27 19:19 UTC (permalink / raw)
To: linux-hotplug
On Fri, 2004-02-27 at 12:37, Greg KH wrote:
> Oh come on. You are so close to actually writing a patch that we can
> use for udev that it's not even funny :)
>
> Care to?
Yah, when I find the time. ;-)
I started doing it (and wrote the previous snippet of code) around the
time of the "great daemonization" so I ended up holding off. I recall I
was also worried that, depending on when the permissions were parsed
once we moved to a daemon, they could be a race.
> Oh I agree it's something that distros will want to use. And how does
> pam come into play here? Doesn't it allow us to do some of this for us?
Pam's consolehelper stuff, which RH uses, can set the permissions on
login. That works for preexisting devices - using a $local type thing
will work for newly hotplugged devices.
And hotplugged devices are an important use case: my camera should only
be readable by me, for example.
Robert Love
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: udev - TODO update
2004-02-12 23:45 udev - TODO update Kay Sievers
` (23 preceding siblings ...)
2004-02-27 19:19 ` Robert Love
@ 2004-02-27 19:20 ` Robert Love
2004-02-28 0:55 ` Greg KH
` (14 subsequent siblings)
39 siblings, 0 replies; 41+ messages in thread
From: Robert Love @ 2004-02-27 19:20 UTC (permalink / raw)
To: linux-hotplug
On Fri, 2004-02-27 at 14:10, Bill Nottingham wrote:
> The pam_console module RH ships does this, based on a config file that
> has device names in it. Obviously, the fact that the config file
> lists device names could run afoul of udev.
Yah, we need some solution here to deal with udev's dynamic names vs.
the static names pam_console expects.
Robert Love
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: udev - TODO update
2004-02-12 23:45 udev - TODO update Kay Sievers
` (24 preceding siblings ...)
2004-02-27 19:20 ` Robert Love
@ 2004-02-28 0:55 ` Greg KH
2004-02-28 13:07 ` Erik van Konijnenburg
` (13 subsequent siblings)
39 siblings, 0 replies; 41+ messages in thread
From: Greg KH @ 2004-02-28 0:55 UTC (permalink / raw)
To: linux-hotplug
On Fri, Feb 27, 2004 at 01:41:57AM +0100, Kay Sievers wrote:
> On Thu, Feb 12, 2004 at 05:26:37PM -0800, Greg KH wrote:
> > On Fri, Feb 13, 2004 at 12:45:38AM +0100, Kay Sievers wrote:
> > >
> > > Here a few questions about my favorite file in the tree :)
> > > - better permission handling
> > >
> > > What is missing here?
> >
> > I don't know for sure. Just a vague feeling that the way we currently
> > handle permissions is pretty lousy. Anyone else feel this way too?
>
> Seems that nobody cares and perhaps the recent klibc permission changes
> and the multiple file config directory are enough to kill these lines? :)
Applied, thanks.
I added something about local user permissions to this file instead.
thanks,
greg k-h
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: udev - TODO update
2004-02-12 23:45 udev - TODO update Kay Sievers
` (25 preceding siblings ...)
2004-02-28 0:55 ` Greg KH
@ 2004-02-28 13:07 ` Erik van Konijnenburg
2004-02-28 16:47 ` Robert Love
` (12 subsequent siblings)
39 siblings, 0 replies; 41+ messages in thread
From: Erik van Konijnenburg @ 2004-02-28 13:07 UTC (permalink / raw)
To: linux-hotplug
On Fri, Feb 27, 2004 at 02:20:08PM -0500, Robert Love wrote:
> On Fri, 2004-02-27 at 14:10, Bill Nottingham wrote:
>
> > The pam_console module RH ships does this, based on a config file that
> > has device names in it. Obviously, the fact that the config file
> > lists device names could run afoul of udev.
>
> Yah, we need some solution here to deal with udev's dynamic names vs.
> the static names pam_console expects.
Would it be sufficient to invoke /sbin/pam_console_apply from hotplug?
Regards,
Erik
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: udev - TODO update
2004-02-12 23:45 udev - TODO update Kay Sievers
` (26 preceding siblings ...)
2004-02-28 13:07 ` Erik van Konijnenburg
@ 2004-02-28 16:47 ` Robert Love
2004-02-28 22:19 ` Kay Sievers
` (11 subsequent siblings)
39 siblings, 0 replies; 41+ messages in thread
From: Robert Love @ 2004-02-28 16:47 UTC (permalink / raw)
To: linux-hotplug
On Sat, 2004-02-28 at 08:07, Erik van Konijnenburg wrote:
> Would it be sufficient to invoke /sbin/pam_console_apply from hotplug?
Probably overkill, but, actually, yes. I had not thought of that.
We would still need a way to teach pam_console about udev device nodes,
which I actually see no easy way of doing.
Robert Love
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: udev - TODO update
2004-02-12 23:45 udev - TODO update Kay Sievers
` (27 preceding siblings ...)
2004-02-28 16:47 ` Robert Love
@ 2004-02-28 22:19 ` Kay Sievers
2004-02-28 22:37 ` Robert Love
` (10 subsequent siblings)
39 siblings, 0 replies; 41+ messages in thread
From: Kay Sievers @ 2004-02-28 22:19 UTC (permalink / raw)
To: linux-hotplug
[-- Attachment #1: Type: text/plain, Size: 875 bytes --]
On Fri, Feb 27, 2004 at 02:19:11PM -0500, Robert Love wrote:
> On Fri, 2004-02-27 at 12:37, Greg KH wrote:
>
> > Oh come on. You are so close to actually writing a patch that we can
> > use for udev that it's not even funny :)
> >
> > Care to?
>
> Yah, when I find the time. ;-)
I did it :)
Please have a look. If this is what you want, I will solve the klibc
beast. We don't need the same for the group ownership, or do we?
> I started doing it (and wrote the previous snippet of code) around the
> time of the "great daemonization" so I ended up holding off. I recall I
> was also worried that, depending on when the permissions were parsed
> once we moved to a daemon, they could be a race.
Oh, I don't think that we still want the to implement daemon. udevd simply
calls our normal udev now and this seems to work well.
Or do I miss something? Greg?
thanks,
Kay
[-- Attachment #2: 04-localuser.patch --]
[-- Type: text/plain, Size: 1468 bytes --]
===== udev-add.c 1.53 vs edited =====
--- 1.53/udev-add.c Sat Feb 28 03:41:27 2004
+++ edited/udev-add.c Sat Feb 28 23:04:22 2004
@@ -32,6 +32,7 @@
#include <grp.h>
#ifndef __KLIBC__
#include <pwd.h>
+#include <utmp.h>
#endif
#include "libsysfs/sysfs/libsysfs.h"
@@ -44,6 +45,8 @@
#include "udevdb.h"
#include "klibc_fixups.h"
+#define LOCAL_USER "$local"
+
/*
* Right now the major/minor of a device is stored in a file called
* "dev" in sysfs.
@@ -132,6 +135,37 @@
return 0;
}
+/* get the local logged in user */
+static void set_to_local_user(char *user)
+{
+ struct utmp *u;
+ time_t recent = 0;
+
+ strnfieldcpy(user, default_owner_str, OWNER_SIZE);
+ setutent();
+ while (1) {
+ u = getutent();
+ if (u == NULL)
+ break;
+
+ /* is this a user login ? */
+ if (u->ut_type != USER_PROCESS)
+ continue;
+
+ /* is this a local login ? */
+ if (strcmp(u->ut_host, ""))
+ continue;
+
+ if (u->ut_time > recent) {
+ recent = u->ut_time;
+ strfieldcpy(user, u->ut_user);
+ dbg("set to local user '%s'", user);
+ break;
+ }
+ }
+ endutent();
+}
+
static int create_node(struct udevice *dev, int fake)
{
struct stat stats;
@@ -175,6 +209,9 @@
if (endptr[0] == '\0')
uid = (uid_t) id;
else {
+ if (strncmp(dev->owner, LOCAL_USER, sizeof(LOCAL_USER)) == 0)
+ set_to_local_user(dev->owner);
+
struct passwd *pw = getpwnam(dev->owner);
if (pw == NULL)
dbg("specified user unknown '%s'", dev->owner);
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: udev - TODO update
2004-02-12 23:45 udev - TODO update Kay Sievers
` (28 preceding siblings ...)
2004-02-28 22:19 ` Kay Sievers
@ 2004-02-28 22:37 ` Robert Love
2004-02-29 4:01 ` Kay Sievers
` (9 subsequent siblings)
39 siblings, 0 replies; 41+ messages in thread
From: Robert Love @ 2004-02-28 22:37 UTC (permalink / raw)
To: linux-hotplug
On Sat, 2004-02-28 at 17:19, Kay Sievers wrote:
> I did it :)
> Please have a look. If this is what you want, I will solve the klibc
> beast.
You are incredible, Kay. This is exactly what I was planning.
Adding utmp parsing to klibc cannot be fun, though.. ;)
> We don't need the same for the group ownership, or do we?
Probably not, although I guess I could see wanting to make the node also
owned by the user's primary group. That would be ultra trivial - it is
just the fourth field in the user's line in passwd.
> Oh, I don't think that we still want the to implement daemon. udevd simply
> calls our normal udev now and this seems to work well.
> Or do I miss something? Greg?
No, the current implementation of the daemon does not have any issues.
I was just worried at the time. As long as we parse the permissions
file on each node creation, we are fine.
Robert Love
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: udev - TODO update
2004-02-12 23:45 udev - TODO update Kay Sievers
` (29 preceding siblings ...)
2004-02-28 22:37 ` Robert Love
@ 2004-02-29 4:01 ` Kay Sievers
2004-03-01 22:44 ` Greg KH
` (8 subsequent siblings)
39 siblings, 0 replies; 41+ messages in thread
From: Kay Sievers @ 2004-02-29 4:01 UTC (permalink / raw)
To: linux-hotplug
[-- Attachment #1: Type: text/plain, Size: 474 bytes --]
On Sat, Feb 28, 2004 at 05:37:10PM -0500, Robert Love wrote:
> On Sat, 2004-02-28 at 17:19, Kay Sievers wrote:
>
> > I did it :)
> > Please have a look. If this is what you want, I will solve the klibc
> > beast.
>
> You are incredible, Kay. This is exactly what I was planning.
And this is exactly what I want to hear :)
> Adding utmp parsing to klibc cannot be fun, though.. ;)
Oh, it's only list of a static record in a file. So here is the first try.
thanks,
Kay
[-- Attachment #2: 04-localuser.patch --]
[-- Type: text/plain, Size: 4282 bytes --]
===== klibc_fixups.c 1.5 vs edited =====
--- 1.5/klibc_fixups.c Mon Feb 23 20:02:03 2004
+++ edited/klibc_fixups.c Sun Feb 29 04:51:47 2004
@@ -25,6 +25,7 @@
#include <stdio.h>
#include <string.h>
#include <ctype.h>
+#include <fcntl.h>
#include <sys/types.h>
#include "klibc_fixups.h"
@@ -32,6 +33,8 @@
#define PW_FILE "/etc/passwd"
#define GR_FILE "/etc/group"
+#define UTMP_FILE "/var/run/utmp"
+
/* return the id of a passwd style line, selected by the users name */
static unsigned long get_id_by_name(const char *uname, const char *dbfile)
@@ -105,6 +108,40 @@
return NULL;
else
return &gr;
+}
+
+
+int ufd = -1;
+
+void setutent()
+{
+ if (ufd < 0)
+ ufd = open(UTMP_FILE, O_RDONLY);
+ fcntl(ufd, F_SETFD, FD_CLOEXEC);
+ lseek(ufd, 0, SEEK_SET);
+}
+
+void endutent() {
+ if (ufd < 0)
+ return;
+ close(ufd);
+ ufd = -1;
+}
+
+struct utmp *getutent(void)
+{
+ static struct utmp utmp;
+ int retval;
+
+ if (ufd < 0) {
+ setutent();
+ if (ufd < 0)
+ return NULL;
+ }
+ retval = read(ufd, &utmp, sizeof(struct utmp));
+ if (retval < 1)
+ return NULL;
+ return &utmp;
}
#endif
===== klibc_fixups.h 1.5 vs edited =====
--- 1.5/klibc_fixups.h Mon Feb 23 20:03:20 2004
+++ edited/klibc_fixups.h Sun Feb 29 04:51:47 2004
@@ -1,7 +1,7 @@
#ifdef __KLIBC__
#ifndef KLIBC_FIXUPS_H
-#define KLIBC_FIXUPS_H
+#define KLIBC_FIXUPS_H
struct passwd {
char *pw_name; /* user name */
@@ -23,6 +23,49 @@
struct passwd *getpwnam(const char *name);
struct group *getgrnam(const char *name);
-#endif
+#define UT_LINESIZE 32
+#define UT_NAMESIZE 32
+#define UT_HOSTSIZE 256
+#define USER_PROCESS 7 /* normal process */
+#define ut_time ut_tv.tv_sec
+
+
+extern int ufd;
+
+struct exit_status {
+ short int e_termination; /* process termination status */
+ short int e_exit; /* process exit status */
+};
+
+struct utmp
+{
+ short int ut_type; /* type of login */
+ pid_t ut_pid; /* pid of login process */
+ char ut_line[UT_LINESIZE]; /* devicename */
+ char ut_id[4]; /* Inittab id */
+ char ut_user[UT_NAMESIZE]; /* username */
+ char ut_host[UT_HOSTSIZE]; /* hostname for remote login */
+ struct exit_status ut_exit; /* exit status of a process marked as DEAD_PROCESS */
+ /* The ut_session and ut_tv fields must be the same size for 32 and 64-bit */
+#if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32
+ int32_t ut_session; /* sid used for windowing */
+ struct {
+ int32_t tv_sec; /* seconds */
+ int32_t tv_usec; /* microseconds */
+ } ut_tv;
+#else
+ long int ut_session;
+ struct timeval ut_tv;
#endif
+ int32_t ut_addr_v6[4]; /* internet address of remote host */
+ char __unused[20]; /* reserved for future use */
+};
+
+struct utmp *getutent(void);
+void setutent(void);
+void endutent(void);
+
+
+#endif /* KLIBC_FIXUPS_H */
+#endif /* __KLIBC__ */
===== udev-add.c 1.53 vs edited =====
--- 1.53/udev-add.c Sat Feb 28 03:41:27 2004
+++ edited/udev-add.c Sun Feb 29 04:53:11 2004
@@ -32,6 +32,7 @@
#include <grp.h>
#ifndef __KLIBC__
#include <pwd.h>
+#include <utmp.h>
#endif
#include "libsysfs/sysfs/libsysfs.h"
@@ -44,6 +45,8 @@
#include "udevdb.h"
#include "klibc_fixups.h"
+#define LOCAL_USER "$local"
+
/*
* Right now the major/minor of a device is stored in a file called
* "dev" in sysfs.
@@ -132,6 +135,37 @@
return 0;
}
+/* get the local logged in user */
+static void set_to_local_user(char *user)
+{
+ struct utmp *u;
+ time_t recent = 0;
+
+ strnfieldcpy(user, default_owner_str, OWNER_SIZE);
+ setutent();
+ while (1) {
+ u = getutent();
+ if (u == NULL)
+ break;
+
+ /* is this a user login ? */
+ if (u->ut_type != USER_PROCESS)
+ continue;
+
+ /* is this a local login ? */
+ if (strcmp(u->ut_host, ""))
+ continue;
+
+ if (u->ut_time > recent) {
+ recent = u->ut_time;
+ strfieldcpy(user, u->ut_user);
+ dbg("local user is '%s'", user);
+ break;
+ }
+ }
+ endutent();
+}
+
static int create_node(struct udevice *dev, int fake)
{
struct stat stats;
@@ -175,6 +209,9 @@
if (endptr[0] == '\0')
uid = (uid_t) id;
else {
+ if (strncmp(dev->owner, LOCAL_USER, sizeof(LOCAL_USER)) == 0)
+ set_to_local_user(dev->owner);
+
struct passwd *pw = getpwnam(dev->owner);
if (pw == NULL)
dbg("specified user unknown '%s'", dev->owner);
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: udev - TODO update
2004-02-12 23:45 udev - TODO update Kay Sievers
` (30 preceding siblings ...)
2004-02-29 4:01 ` Kay Sievers
@ 2004-03-01 22:44 ` Greg KH
2004-03-01 23:05 ` Robert Love
` (7 subsequent siblings)
39 siblings, 0 replies; 41+ messages in thread
From: Greg KH @ 2004-03-01 22:44 UTC (permalink / raw)
To: linux-hotplug
On Sun, Feb 29, 2004 at 05:01:47AM +0100, Kay Sievers wrote:
> On Sat, Feb 28, 2004 at 05:37:10PM -0500, Robert Love wrote:
> > On Sat, 2004-02-28 at 17:19, Kay Sievers wrote:
> >
> > > I did it :)
> > > Please have a look. If this is what you want, I will solve the klibc
> > > beast.
> >
> > You are incredible, Kay. This is exactly what I was planning.
>
> And this is exactly what I want to hear :)
>
> > Adding utmp parsing to klibc cannot be fun, though.. ;)
>
> Oh, it's only list of a static record in a file. So here is the first try.
Sweet, this looks nice. I've applied this, care to update the
documentation too?
Hm, that should be Robert's job actually, he should do something for
real... :)
thanks,
greg k-h
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: udev - TODO update
2004-02-12 23:45 udev - TODO update Kay Sievers
` (31 preceding siblings ...)
2004-03-01 22:44 ` Greg KH
@ 2004-03-01 23:05 ` Robert Love
2004-03-01 23:16 ` Greg KH
` (6 subsequent siblings)
39 siblings, 0 replies; 41+ messages in thread
From: Robert Love @ 2004-03-01 23:05 UTC (permalink / raw)
To: linux-hotplug
On Mon, 2004-03-01 at 17:44, Greg KH wrote:
> Hm, that should be Robert's job actually, he should do something for
> real... :)
Hey, I wrote the nifty local user detection snippet - but, I owe Kay, so
here is an updated man page.
Robert Love
udev.8 | 11 +++++++++++
1 files changed, 11 insertions(+)
diff -urN udev-019/udev.8 udev/udev.8
--- udev-019/udev.8 2004-02-27 20:11:47.000000000 -0500
+++ udev/udev.8 2004-03-01 18:04:52.768322840 -0500
@@ -288,6 +288,17 @@
dsp1:::0666
.fi
.P
+The value
+.I $local
+can be substituted for a specific username. In that case, udev will determine
+the current local user at the time of device node creation and substitute
+that username as the owner of the new device node. This is useful, for
+example, to let hot-plugged devices, such as cameras, be owned by the user at
+the current console. Note that if no user is currently logged in, or if udev
+otherwise fails to determine a current user, the
+.I default_owner
+value is used in lieu.
+.P
A number of different fields in the above configuration files support a simple
form of shell style pattern matching. It supports the following pattern characters:
.TP
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: udev - TODO update
2004-02-12 23:45 udev - TODO update Kay Sievers
` (32 preceding siblings ...)
2004-03-01 23:05 ` Robert Love
@ 2004-03-01 23:16 ` Greg KH
2004-03-02 0:04 ` Kay Sievers
` (5 subsequent siblings)
39 siblings, 0 replies; 41+ messages in thread
From: Greg KH @ 2004-03-01 23:16 UTC (permalink / raw)
To: linux-hotplug
On Mon, Mar 01, 2004 at 06:05:59PM -0500, Robert Love wrote:
> On Mon, 2004-03-01 at 17:44, Greg KH wrote:
>
> > Hm, that should be Robert's job actually, he should do something for
> > real... :)
>
> Hey, I wrote the nifty local user detection snippet - but, I owe Kay, so
> here is an updated man page.
Heh, thanks. I've applied this.
greg k-h
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: udev - TODO update
2004-02-12 23:45 udev - TODO update Kay Sievers
` (33 preceding siblings ...)
2004-03-01 23:16 ` Greg KH
@ 2004-03-02 0:04 ` Kay Sievers
2004-03-02 0:09 ` Greg KH
` (4 subsequent siblings)
39 siblings, 0 replies; 41+ messages in thread
From: Kay Sievers @ 2004-03-02 0:04 UTC (permalink / raw)
To: linux-hotplug
[-- Attachment #1: Type: text/plain, Size: 892 bytes --]
On Mon, Mar 01, 2004 at 02:44:35PM -0800, Greg KH wrote:
> On Sun, Feb 29, 2004 at 05:01:47AM +0100, Kay Sievers wrote:
> > On Sat, Feb 28, 2004 at 05:37:10PM -0500, Robert Love wrote:
> > > On Sat, 2004-02-28 at 17:19, Kay Sievers wrote:
> > >
> > > > I did it :)
> > > > Please have a look. If this is what you want, I will solve the klibc
> > > > beast.
> > >
> > > You are incredible, Kay. This is exactly what I was planning.
> >
> > And this is exactly what I want to hear :)
> >
> > > Adding utmp parsing to klibc cannot be fun, though.. ;)
> >
> > Oh, it's only list of a static record in a file. So here is the first try.
>
> Sweet, this looks nice. I've applied this, care to update the
> documentation too?
>
> Hm, that should be Robert's job actually, he should do something for
> real... :)
I promise, that I will not take every item you put in the TODO list :)
Kay
[-- Attachment #2: 02-TODO-update --]
[-- Type: text/plain, Size: 411 bytes --]
===== TODO 1.18 vs edited =====
--- 1.18/TODO Sat Feb 28 01:55:24 2004
+++ edited/TODO Tue Mar 2 00:52:24 2004
@@ -7,7 +7,6 @@
- more documentation (can never have too much.)
-- create way to set permission to the local user.
- install the proper init.d script based on the distro we are running on.
- persuade the distro packagers to submit their changes (or just steal them
if we can find them...)
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: udev - TODO update
2004-02-12 23:45 udev - TODO update Kay Sievers
` (34 preceding siblings ...)
2004-03-02 0:04 ` Kay Sievers
@ 2004-03-02 0:09 ` Greg KH
2004-03-02 7:24 ` [linux-hotplug-devel] " Wout Mertens
` (3 subsequent siblings)
39 siblings, 0 replies; 41+ messages in thread
From: Greg KH @ 2004-03-02 0:09 UTC (permalink / raw)
To: linux-hotplug
On Tue, Mar 02, 2004 at 01:04:11AM +0100, Kay Sievers wrote:
> On Mon, Mar 01, 2004 at 02:44:35PM -0800, Greg KH wrote:
> > On Sun, Feb 29, 2004 at 05:01:47AM +0100, Kay Sievers wrote:
> > > On Sat, Feb 28, 2004 at 05:37:10PM -0500, Robert Love wrote:
> > > > On Sat, 2004-02-28 at 17:19, Kay Sievers wrote:
> > > >
> > > > > I did it :)
> > > > > Please have a look. If this is what you want, I will solve the klibc
> > > > > beast.
> > > >
> > > > You are incredible, Kay. This is exactly what I was planning.
> > >
> > > And this is exactly what I want to hear :)
> > >
> > > > Adding utmp parsing to klibc cannot be fun, though.. ;)
> > >
> > > Oh, it's only list of a static record in a file. So here is the first try.
> >
> > Sweet, this looks nice. I've applied this, care to update the
> > documentation too?
> >
> > Hm, that should be Robert's job actually, he should do something for
> > real... :)
>
> I promise, that I will not take every item you put in the TODO list :)
Heh, yeah, right...
applied.
greg k-h
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [linux-hotplug-devel] Re: udev - TODO update
2004-02-12 23:45 udev - TODO update Kay Sievers
` (35 preceding siblings ...)
2004-03-02 0:09 ` Greg KH
@ 2004-03-02 7:24 ` Wout Mertens
2004-03-02 7:32 ` Wout Mertens
` (2 subsequent siblings)
39 siblings, 0 replies; 41+ messages in thread
From: Wout Mertens @ 2004-03-02 7:24 UTC (permalink / raw)
To: linux-hotplug
Friday at 14:19, Robert Love ponderously produced:
> On Fri, 2004-02-27 at 12:37, Greg KH wrote:
> > Oh I agree it's something that distros will want to use. And how does
> > pam come into play here? Doesn't it allow us to do some of this for us?
>
> Pam's consolehelper stuff, which RH uses, can set the permissions on
> login. That works for preexisting devices - using a $local type thing
> will work for newly hotplugged devices.
>
> And hotplugged devices are an important use case: my camera should only
> be readable by me, for example.
So we can safely assume that whoever owns /dev/console is the actual
user who plugged in the device?
Why not just copy the permissions from that file then? It will save
having to parse through all of utmp...
For comparison, this is what I do in my silly hotplug script. It's sh,
and tries to be robust. Of course, this is three lines of C, left as an
exercise to the reader :)
------
CONSOLEUSER=`stat -c%U /dev/console 2>/dev/null`
if [ -z "$CONSOLEUSER" ]
then
set `ls -l /dev/console`
CONSOLEUSER=$3
fi
[ -n "$CONSOLEUSER" ] || CONSOLEUSER=root
------
Wout.
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [linux-hotplug-devel] Re: udev - TODO update
2004-02-12 23:45 udev - TODO update Kay Sievers
` (36 preceding siblings ...)
2004-03-02 7:24 ` [linux-hotplug-devel] " Wout Mertens
@ 2004-03-02 7:32 ` Wout Mertens
2004-03-02 20:15 ` Greg KH
2004-03-02 20:55 ` Wout Mertens
39 siblings, 0 replies; 41+ messages in thread
From: Wout Mertens @ 2004-03-02 7:32 UTC (permalink / raw)
To: linux-hotplug
Sunday at 05:01, Kay Sievers ponderously produced:
> On Sat, Feb 28, 2004 at 05:37:10PM -0500, Robert Love wrote:
> > On Sat, 2004-02-28 at 17:19, Kay Sievers wrote:
> >
> > > I did it :)
> > > Please have a look. If this is what you want, I will solve the klibc
> > > beast.
> >
> > You are incredible, Kay. This is exactly what I was planning.
>
> And this is exactly what I want to hear :)
>
> > Adding utmp parsing to klibc cannot be fun, though.. ;)
>
> Oh, it's only list of a static record in a file. So here is the first try.
Uhm, actually, you should use getpwuid() on a real system. /etc/group is
just some old file. /etc/nsswitch.conf tells you where to find the real
information, which could be on LDAP or whatnot. getent() does this for
you.
Of course, klibc probably doesn't have getpwuid(). So for early
userspace your implementation may be correct.
But consider my previous post: Why not just copy the permissions from
/dev/console?
Cheers,
Wout.
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [linux-hotplug-devel] Re: udev - TODO update
2004-02-12 23:45 udev - TODO update Kay Sievers
` (37 preceding siblings ...)
2004-03-02 7:32 ` Wout Mertens
@ 2004-03-02 20:15 ` Greg KH
2004-03-02 20:55 ` Wout Mertens
39 siblings, 0 replies; 41+ messages in thread
From: Greg KH @ 2004-03-02 20:15 UTC (permalink / raw)
To: linux-hotplug
On Tue, Mar 02, 2004 at 08:32:38AM +0100, Wout Mertens wrote:
> Sunday at 05:01, Kay Sievers ponderously produced:
>
> > On Sat, Feb 28, 2004 at 05:37:10PM -0500, Robert Love wrote:
> > > On Sat, 2004-02-28 at 17:19, Kay Sievers wrote:
> > >
> > > > I did it :)
> > > > Please have a look. If this is what you want, I will solve the klibc
> > > > beast.
> > >
> > > You are incredible, Kay. This is exactly what I was planning.
> >
> > And this is exactly what I want to hear :)
> >
> > > Adding utmp parsing to klibc cannot be fun, though.. ;)
> >
> > Oh, it's only list of a static record in a file. So here is the first try.
>
> Uhm, actually, you should use getpwuid() on a real system. /etc/group is
> just some old file. /etc/nsswitch.conf tells you where to find the real
> information, which could be on LDAP or whatnot. getent() does this for
> you.
>
> Of course, klibc probably doesn't have getpwuid(). So for early
> userspace your implementation may be correct.
>
> But consider my previous post: Why not just copy the permissions from
> /dev/console?
Because udev creates /dev/console :)
thanks,
greg k-h
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [linux-hotplug-devel] Re: udev - TODO update
2004-02-12 23:45 udev - TODO update Kay Sievers
` (38 preceding siblings ...)
2004-03-02 20:15 ` Greg KH
@ 2004-03-02 20:55 ` Wout Mertens
39 siblings, 0 replies; 41+ messages in thread
From: Wout Mertens @ 2004-03-02 20:55 UTC (permalink / raw)
To: linux-hotplug
It was 12:15, Today, when Greg KH proclaimed:
> On Tue, Mar 02, 2004 at 08:32:38AM +0100, Wout Mertens wrote:
> > But consider my previous post: Why not just copy the permissions from
> > /dev/console?
>
> Because udev creates /dev/console :)
Sure, at a time that no user is logged in. So that gets root:root. But
once a user logs in, pam_consolehelper will set all devices according to
the local rules.
_After_ a user logs in, any devices that are created can be assigned to
$local, and /dev/console will already be owned by that same user.
You don't need to walk through a potentially largish utmp for each
device that gets created, and the superuser has more control over the
situation.
And consider the case where there is no pam_consolehelper. In that case,
any user that logs in will not have access to cdwriters, audio, dri
devices, _unless_ they are already set to his/her userid.
That is a static setup, and can just as easily be covered by udev rules.
So in both setups, there doesn't seem to be a need for complicated
things with utmp. (I'm simpleminded :) )
Of course, it's already written, but I think it's likely more
errorprone. Just my 2 cents...
Wout.
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 41+ messages in thread
end of thread, other threads:[~2004-03-02 20:55 UTC | newest]
Thread overview: 41+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-12 23:45 udev - TODO update Kay Sievers
2004-02-13 1:26 ` Greg KH
2004-02-13 1:59 ` Kay Sievers
2004-02-13 6:16 ` Daniel Drake
2004-02-13 8:31 ` Olaf Hering
2004-02-13 17:52 ` Mike Frysinger
2004-02-13 19:34 ` Daniel Stekloff
2004-02-13 22:53 ` Greg KH
2004-02-17 1:41 ` Greg KH
2004-02-17 1:48 ` Mike Frysinger
2004-02-27 0:41 ` Kay Sievers
2004-02-27 0:49 ` Robert Love
2004-02-27 1:00 ` Greg KH
2004-02-27 1:13 ` Mike Frysinger
2004-02-27 1:23 ` Mike Waychison
2004-02-27 1:27 ` Robert Love
2004-02-27 1:36 ` Robert Love
2004-02-27 2:24 ` Bill Nottingham
2004-02-27 11:03 ` Robert McMeekin
2004-02-27 15:45 ` Kay Sievers
2004-02-27 17:35 ` Greg KH
2004-02-27 17:37 ` Greg KH
2004-02-27 18:08 ` Mike Waychison
2004-02-27 19:10 ` Bill Nottingham
2004-02-27 19:19 ` Robert Love
2004-02-27 19:20 ` Robert Love
2004-02-28 0:55 ` Greg KH
2004-02-28 13:07 ` Erik van Konijnenburg
2004-02-28 16:47 ` Robert Love
2004-02-28 22:19 ` Kay Sievers
2004-02-28 22:37 ` Robert Love
2004-02-29 4:01 ` Kay Sievers
2004-03-01 22:44 ` Greg KH
2004-03-01 23:05 ` Robert Love
2004-03-01 23:16 ` Greg KH
2004-03-02 0:04 ` Kay Sievers
2004-03-02 0:09 ` Greg KH
2004-03-02 7:24 ` [linux-hotplug-devel] " Wout Mertens
2004-03-02 7:32 ` Wout Mertens
2004-03-02 20:15 ` Greg KH
2004-03-02 20:55 ` Wout Mertens
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).