How to permanently modify USB device permissions in Linux
This article is about how to permanently modify the permissions of USB devices in Linux. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
problem
When I tried to run the USB GPS receiver in Linux, I encountered the following error from gpsd. It appears that gpsd does not have access to the USB device (/ dev/ttyUSB0). How do I permanently modify its permissions on Linux?
1. Gpsd [377]: gpsd:ERROR: read-only device open failed:Permission denied2. Gpsd [377]: gpsd:ERROR:/dev/ttyUSB0: device activation failed.3. Gpsd: gpsd:ERROR: device open failed:Permission denied-retrying read-only solution
When you are running a process that reads or writes to USB devices, the user / group of the process must have permission to do so. Of course, you can manually change the permissions of the USB device with the chmod command, but the manual permission changes are only temporary. The USB device restores its default permissions the next time it restarts.
As a permanent way, you can create a udev-based USB permission rule that can assign any permission mode according to your choice. Here's what to do.
1. Use the lsusb command to find out the vendorID and productID of the USB device
$lsusb-vvv
In the lsusb output above, find your USB device and find the "idVendor" and "idProduct" fields. In this case, our results are idVendor (0x067b) and idProduct (0x2303)
two。 Create a new udev rule
$sudovi/etc/udev/rules.d/50-myusb.rules
Replace the default values with your own "idVendor" and "idProduct". MODE= "0666" represents the permissions of the USB device.
SUBSYSTEMS== "usb", ATTRS {idVendor} = = "067b", ATTRS {idProduct} = = "2303", GROUP= "users", MODE= "0666"
3. Restart the computer or reload the udev rule
$sudo udevadm control-reload
Verify the permissions of the USB device:
Thank you for reading! This is the end of this article on "how to permanently modify USB device permissions in Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!