I have a USB scale, a USB HID. Currently, when it is plugged in, the permissions only allow the superuser to access it. How can I configure udev to let anybody access this device? I have the vendor and product IDs, but I would like to match it based on the HID type instead.

Right now, I'm having trouble finding any existing rule that applies to this (I grepped for "hidraw" in /lib/udev/rules.d and /etc/udev/rules.d, among other things).

5 Answers 5


Normally, this is done by adding to /etc/udev/rules.d a file maybe named 50-usb-scale.conf with contents like this:

SUBSYSTEM=="usb", ATTR{idVendor}=="HEX1", ATTR{idProduct}=="HEX2", MODE="0666"

Where HEX1 and HEX2 are replaced with the vendor and product id respectively.

To match on the Interface type instead, you could try replacing ATTR{idVendor}=="HEX1", ATTR{idProduct}=="HEX2" with a match for bInterfaceClass being 03 (HID):

SUBSYSTEM=="usb", ATTR{bInterfaceClass}=="03", MODE="0666"

But be warned, that will catch mice and keyboards too.

  • 5
    On ubuntu 14.04 you have to use MODE:="0666", without the colon, the rule does nothing.
    – EdwinW
    Jul 26, 2014 at 14:00
  • 2
    On 14.04 this file has to have a .rules extension. A file with a .conf extension won't work.
    – cherno
    Jun 26, 2015 at 5:02
  • 1
    use lsusb -vvv to get the idProduct and idVendor
    – Xavier13
    May 21, 2016 at 15:26
  • 2
    Since this question is quite popular in google output... I think it should be ATTRS, not ATTR - at least this change fixed it for me.
    – infthi
    Jun 16, 2016 at 18:45
  • 2
    On 14.04.5 LTS I found: lsusb is a good start to see what's connected and IDs. idVendor and idProduct matches seem case-sensitive, so ID DA77 doesn't work for me but da77 does. (Handy diagnostic: udevadm info --attribute-walk /dev/bus/usb/008/023, bus 008 device 023 my example; lsusb for yours.) After adding a rule, sudo udevadm control --reload-rules and then sudo udevadm trigger avoids reboot: changes are seconds after that. ATTR vs ATTRS made no odds. My .rules file reads: SUBSYSTEM=="usb", ATTR{idVendor}=="da77", ATTR{idProduct}=="d12e", GROUP="users", MODE="0666".
    – El Zorko
    Aug 29, 2016 at 12:40

Just for the summary:

You may filter for:

  • idVendor
  • idProduct
  • serial

And use:

== Compare for equality.

!= Compare for inequality.

= Assign a value to a key. Keys that represent a list are reset and only this single value is assigned.

+= Add the value to a key that holds a list of entries.

:= Assign a value to a key finally; disallow any later changes.

You may give a specific device a specific new path in /dev/...

KERNEL=="hiddev*", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="05df", ATTRS{serial}=="1234567", GROUP="cdrom", OWNER="user28", MODE="0640", SYMLINK+="myhid"

Results in:

You can access the device via '/dev/hiddevx' or via '/dev/myhid' easyly, every user in group 'cdrom' may read from the device. Owner 'user28' may read and write.

or simplest:

KERNEL=="hiddev*", ATTRS{idVendor}=="16c0", MODE="0666"

Results in: Every user may access every hiddevice from Vendor 0x16c0

For details see: Docs

  • 3
    := is not for comparisons. Docs say "Assign a value to a key finally; disallow any later changes."
    – Lucas
    Dec 14, 2017 at 19:22

In case you need to change (like me) ttyACM0 permissions, this are my settings:

KERNEL=="ttyACM0", MODE="0777"

It failed when I tried to specify the vendor and product ID. I am not sure why.

  • Yeah, the Kernel option works for most HID devices, better than the USB subsystem one Apr 22, 2014 at 12:35

If its a HIDRAW device, you have to

chmod 0666 /dev/hidrawX

where X is the hid device number, e.g hidraw0. you can do

ls /dev/hid*

to see a list :) Or just do

sudo chmod 0666 /dev/hidraw*

to set for all hidraw devices, probably not recommended.

  • 2
    That gets the job done as a quick hack, but the setting won't persist across a reboot or even hot-plugging the device. The UDEV rule is the way to go if you want your settings to persist.
    – David C.
    Jul 22, 2021 at 20:09

Ubuntu 18.04 update/clarification:

Kees Cook's answer is close but requires 2 changes to work in 18.04 (the current release and only one I've tested this on).

  1. Find your idVendor and idProduct with lsusb.
    • This will be the 2 hex values after "ID", separated by a colon. I'm adding a scanner. lsusb gave me:
      Bus 001 Device 011: ID 04b8:014a Seiko Epson Corp. 
  2. As root add a file to /etc/udev/rules.d
    • Something like 50-usb-epsonscanner.rules
    • The extension must be ".rules"  
  3. In that file add:
    SUBSYSTEM=="usb", ATTRS{idVendor}=="04b8", ATTR{idProduct}=="014a", MODE="0666"
    But with your idVendor and idProduct hex values.
    • Note it's "ATTRS" not "ATTR".
  4. Re-login. No need to reboot.
  • ATTRS both for vendor and product ID? Then your code sample is wrong (just as you state two lines later). Apr 23, 2019 at 21:27
  • Just the second one is ATTR. Works here. Am guessing it's an error that could change without warning.
    – gatohaus
    May 4, 2019 at 22:11
  • 1
    I think what's happening is that the second one is just getting ignored. So it seems to work because you don't have a second device with the same vendor ID.
    – David C.
    Jul 22, 2021 at 20:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.