On Sun, Aug 28, 2011 at 20:19, Michael Katzmann <vk2bea@xxxxxxxxx> wrote: > I have seen examples of udev rules using UDISKS_PRESENTATION_HIDE to prevent > the auto-mounting of USB disks as they are attached. > > Rather than setting up a permanent rule, I would like to have a *program* do > this on startup and remove the rule when it exits. How can I do this ? You could place a rule in /run/udev/rules.d/ that does that. But see below. > Do I need to manipulate the udev database and if so are there guidelines to > do this ? I have seen references to sending messages on the dbus to > org.freedesktop.UDisks but have found no documentation or examples. > > Can anyone give me some guidance on this ? I realize I could manipulate a > /etc/udev/rules.d file and force the reload udev rules with "udevadm > control" but that is really ugly... there must be a cleaner more direct > way! Udev rules or udisks act system wide, but the policy to mount a device runs in the user session. The user session only talks to the privileged processes which, after privilege checks, act on behalf of the user. What you probably want, and what might be nice to have for other things too, is a way for an application to dynamically inhibit the user session's auto-mounting. And unlike the writing-out of a static file, such a dynamic lock should automatically be cleared when the application goes away. Changing system-wide behaviour is something we should avoid doing from user applications, unless they are supposed to change the system, like an update process or whatever. Add David to Cc:. Kay -- To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html