I'm investigating dynamic device name mapping via udev.

The goal:

On a multi user system, each user can allocate and free devices like usb-serial converters or PCIe cards (FPGAs). If an user allocates a device, the /dev/<user>/<device> nodes shall be created with a dynamic name and permissions for the allocating user. If the user releases the device the devfs nodes need to be removed/renamed and the permissions need to be revoked.

Current situation:

I'm experimenting on /dev/ttyUSB1 - an usb-serial converter. I wrote a Python script which is called from udev while creating the dev-node. It expects the VendorID, ProductID and SerialNo of a usb device and returns the devfs node name: e.g. paebbels/ttyUSB. This works with symlinks, so the original devfs node ttyUSB1 is still present.

How can I use my script to change the original devfs name?

I tried to use the NAME command in my udev rule, but it does not work. The documentation states: NAME can only be used once. Is there a default rule in udev which uses NAME before my rule? /etc/udev/... does not contain such a rule.

In a latter phase, my script will also return the username, group and permissions for the devfs node.

Secondary question:

Should I create the device files as planned in /dev/<user>/<device> or in ~/fpga1/<device>?

  • 2
    There is an inherent flaw in your design: access rights get checked when the device is opened. Changing permission or even removing the device node does not force the already open file descriptors to get closed. So, to properly implement what you're trying to achieve, you'd have to implement a proxy device, which can be forced to shut down without the underlying serial port device being removed from the system. Commented Oct 9, 2015 at 12:56
  • @LaszloValko That's a good point and I'll investigate it. Nevertheless, I would keep the proposed concept for usability reasons: all Linux devices connected to one extension card in the server are listed in a separate /dev/<device>/* sub folder. It's also possible to find running processes of a user, which hold open file handles to e.g. /dev/KC705_0/ttyUSB by searching /proc/<processid>/fd/*.
    – Paebbels
    Commented Oct 9, 2015 at 20:55

1 Answer 1


1. Question:

I am not sure, but take a look at /lib/udev/rules.d/60-persistent-serial.rules

2. Question:

If udev itself assigns the device names I would put them all in a subdirectory of /dev. If not in /run/$UID/devices.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .