I use several Linux servers hosts, in which multiple serial-to-USB links are plugged in. They look like /dev/ttyUSBx devices, where x is a number starting from 0. Client devices are often rebooted or go offline or are unplugged or new ones are added. This causes ttyUSB device numbering to change constantly because each new client takes lowest unused number.

Can I somehow set client devices to have constant numbers? E.g. client A will be ttyUSB0, then client B will be ttyUSB1 and so on. And when client A is offline and client B reboots it will come back online as ttyUSB1, and there will be no ttyUSB0 (since it is offline).

PS: hosts are either Debian or Ubuntu, mostly Debian.

3 Answers 3


There are 2 solutions that can help in this case:

  1. Edit the udev rule to create a symlink for your device like /dev/ttyClientA and /dev/ttyClientB, then you don't need to worry about the postfix number after ttyUSB anymore:
  • Check the devices which are mounted in your system:

      # lsusb
      Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
      Bus 001 Device 006: ID 04d8:0205 Microchip Technology, Inc. innodisk USB Dual CAN
      Bus 001 Device 005: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter 
      Bus 001 Device 004: ID 0483:5740 STMicroelectronics Virtual COM Port
      Bus 001 Device 002: ID 0403:6001 Future Technology Devices International, Ltd FT232 Serial (UART) IC
      Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
  • Get the vendorID, productID, and serial number. Make sure they are matched with what you want when using lsusb. For example, I want to use ttyUSB1

      # TTYDEVICE="ttyUSB1" ; sudo echo -e "$(udevadm info -a -n /dev/${TTYDEVICE} | grep ATTRS{idVendor}) \n$(udevadm info -a -n /dev/${TTYDEVICE} | grep ATTRS{idProduct}) \n$(udevadm info -a -n /dev/${TTYDEVICE} | grep ATTRS{serial}) \n"
  • 1d6b:0002 is the USB hub ic in the system then we don't use, we use the attributes to make a udev rule. Add following line to file /etc/udev/rules.d/99-usb-serial.rules:

      SUBSYSTEM=="tty", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", ATTRS{serial}=="0000:00:14.0", SYMLINK+="ttyClientA"
  • reload udev, after this step, your device should be /dev/ttyClientA:

      # sudo udevadm control --reload-rules && sudo udevadm trigger
  1. If option 1 doesn't work, can go for this solution. Scan all the ttyUSBx devices with commands in option 1 to get the vendorID, productID, and serial number and check if they are matched with what you want then you use that device in your application.

To view the list of available serial devices examine the contents of /dev/serial/by-id/. For instance, in my system, there is a symlink /dev/serial/by-id/usb-FTDI_FT230X_Basic_UART_D307YFO0-if00-port0 pointing to /dev/ttyUSB0.


That is probably not possible. But you can have udev create symlinks for you when a device appears. You would not connect to /dev/ttyUSB0 any more but to e.g. /dev/ttyUSB-A.

You must log in to answer this question.

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