Permanent modification of USB device permissions in Linux

Source: Internet
Author: User

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 
Solution

When 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


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.