Permanent modification of USB device permissions in Linux
Permanent modification of USB device permissions in LinuxProblem
When I tried to run a usb gps receiver in Linux, I encountered the following error from gpsd. It seems that gpsd has no permission to access the USB device (/dev/ttyUSB0 ). How can 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[377]: gpsd:ERROR: device open failed:Permission denied - retrying read-only
SolutionWhen you are running a process that reads or writes data to a USB device, the user/Group of the process must have the permission to do so. Of course, you can manually use the chmod command to change the permissions of the USB device, but the manual permission change is only temporary. The default permission of the USB device will be restored when it is restarted next time.
As a permanent method, you can create a udev-based USB permission rule, which can assign any permission mode according to your choice. The following describes how to do this.
1. Use the lsusb command to find 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 example, idVendor (0x067b) and idProduct (0x2303) are returned)
2. 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" indicates the permission of the USB device.
SUBSYSTEMS=="usb", ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", GROUP="users", MODE="0666"3. Restart your computer or reload udev rules$ sudo udevadm control --reload
Verify the permissions of the USB device:
Original reprinted address: http://www.linuxprobe.com