I have a modem with 16 ports used for sending SMS.

When it's connected to my Linux machine, I get 16 ports from ttyUSB0 to ttyUSB15. Currently if I remove this modem and attach another, I get 16 ports from ttyUSB0 to ttyUSB15.

How can I reserve first 16 ports for specific vendor with creating udev file, so when I remove this modem and insert another one, it is assigned from ttyUSB16 onwards?


My udev rule file contents are as follows, which is working, but port number changes everytime I replug.

Name=="Future Technology Devices International,Ltd",SUBSYSTEMS=="usb", ATTRS{idProduct}=="6011", ATTRS{idVendor}=="0403", SYMLINK="Ketan%b", KERNEL=="ttyUSB[0-15]*", MODE="0666", SYMLINK+="ttyUSB1",


ls -l /dev/K*
lrwxrwxrwx 1 root root 7 2013-01-08 15:09 /dev/Ketan-8.1 -> ttyUSB1
lrwxrwxrwx 1 root root 7 2013-01-08 15:09 /dev/Ketan-8.2 -> ttyUSB5
lrwxrwxrwx 1 root root 8 2013-01-08 15:09 /dev/Ketan-8.3 -> ttyUSB11
lrwxrwxrwx 1 root root 8 2013-01-08 15:09 /dev/Ketan-8.4 -> ttyUSB12

Here ports are 16, but they are divided in group of four. ttyUSB 1,5,11,12 values are changing every time I plug a modem.

  • Does unbuffer udevadm monitor --environment | grep 'ID_SERIAL=' output different serial numbers for both modems when detaching/attaching it?
    – jippie
    Commented Jan 4, 2013 at 13:09

1 Answer 1


If you loosen the requirement for using ttyUSB0 - ttyUSB31, then you may just have a possibility. What I've done is let udev create symlinks to the device nodes assigned by the kernel. You cannot reliably hardwire a physical device to use ttyUSB0, you can however reliably add a symlink ttyUSB001 to point to whichever device node you want. The trick here is that the kernel will never assign a device node a name that starts with ttyUSB0.., except for exactly ttyUSB0 itself. This trick therefore works for max 99 devices, but it can easily be changed to 4 digits (and 999 devices), as long as the first digit remains 0.

For this to work, you have to be able to uniquely identify both modems. Check if they have unique serial numbers by running this command while unplug/plug the device:

unbuffer udevadm monitor --environment | grep 'ID_SERIAL='

I don't know your modem, but this is the /etc/udev/rules.d/60-persistent-serial.rules file that I have been using to uniquely identify each of my Arduino's:

ACTION!="add", GOTO="persistent_serial_end"
SUBSYSTEM!="tty", GOTO="persistent_serial_end"
KERNEL!="ttyUSB[0-9]*", GOTO="persistent_serial_end"

# This is old 11.10 style: IMPORT="usb_id --export %p"
ENV{ID_SERIAL}=="04fc_RS232C_to_USB_Adapter"    , SYMLINK="multimeter"                                       , OWNER="jhendrix"
ENV{ID_SERIAL}=="FTDI_FT232R_USB_UART_A800FERY" , SYMLINK="arduinoMega1280-001"       , SYMLINK+="ttyUSB001" , OWNER="jhendrix"
ENV{ID_SERIAL}=="FTDI_FT232R_USB_UART_A900F4EF" , SYMLINK="arduinoMega1280-002"       , SYMLINK+="ttyUSB002" , OWNER="jhendrix"
ENV{ID_SERIAL}=="FTDI_FT232R_USB_UART_A900f3Kr" , SYMLINK="arduinoDuemilanove168-003" , SYMLINK+="ttyUSB003" , OWNER="jhendrix"


Of course you have to replace a few things like OWNER, which is the user to which the devices are assigned and ENV{ID_SERIAL} which can be found by:

unbuffer udevadm monitor --environment | grep 'ID_SERIAL='

And last but not least the various SYMLINKs should be replaced by the exact name you want to use. This file makes any of my Arduino's available under three names (eg.):

/dev/ttyUSB0             # dynamic, assigned by kernel upon plugging the device
/dev/arduinoMega1280-002 # static,  symlink -> ttyUSB0
/dev/ttyUSB002           # static,  symlink -> ttyUSB0 , this is what you are asking for.

Check my private wiki article on this for more details.

  • As I create my rule file SUBSYSTEMS=="usb", ATTRS{idProduct}=="2303", ATTRS{idVendor}=="067b", SYMLINK="Ketan%b", KERNEL=="ttyUSB*", MODE="0666", works but I am not getting fix ports, I used your trick not working. All is well in my conf. But The port number changes everytime. I need to fix it.
    – KK Patel
    Commented Jan 8, 2013 at 8:13
  • Please share your file in your question.
    – jippie
    Commented Jan 8, 2013 at 8:55

You must log in to answer this question.

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