devd.conf and $USER
freebsd at edvax.de
Sun Jan 14 03:02:24 UTC 2018
On Sun, 14 Jan 2018 09:30:47 +0800, blubee blubeeme wrote:
> Is there a way to pass the $USER env variable to an action initiated by
What should this variable contain?
In case of FreeBSD (and UNIX in general), multi-user systems
allow that 0, 1, or 100+ users are logged in at the same time.
As devd handles dynamic device configuration at root level,
other user accounts active on the system don't matter.
However, it is easy to let devd branch to a custom script that
checks, for example, if a specific user is currently logged in,
and if it is, performs a user-specific action. In this case,
the corresponding logic needs to be implemented in that script,
as devd has no access to if a specific user is logged in at the
time a certain action needs to be performed (except, of course,
it is hardcoded into its configuration file, but in my opinion,
it's much easier and more convenient to put that logic into an
Many years ago, I needed exact that solution to make a crappy
printer work. Upon attaching the printer, the system checked if
the only user who was permitted to use that particular printer
was currently logged in, and if he was, started certain programs
first as root, then from that user account, created some specific
files in the user's directory, and finally, after some delay,
used xmessage to show the user a message that the printer was
As you can see, it was a _very_ crappy printer which needed all
this terrible stuff. ;-)
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
More information about the freebsd-questions