Specific USB Hardware is listed here:

ls -l /dev/input/by-id/

The symbolic link: /dev/input/by-id/usb-Metrologic_Metrologic_Scanner-event-kbd resolves to: /dev/input/eventxx where xx is an integer number. In this example event19:

ls -l /dev/input/by-id/usb-Metrologic_Metrologic_Scanner-event-kbd
lrwxrwxrwx 1 root root 10 Nov 23 22:02 /dev/input/by-id/usb-Metrologic_Metrologic_Scanner-event-kbd -> ../event19

Is there a command that can act upon the symbolic link that will change permissions of the target file? i.e.

chmod 666 /dev/input/eventXX

Looking forward to the clever and elegant examples.


How about

chmod 666 /dev/input/by-id/usb-Metrologic_Metrologic_Scanner-event-kbd

I hope that's sufficiently elegant!

From the GNU manual for chmod:

chmod never changes the permissions of symbolic links, since the chmod system call cannot change their permissions. This is not a problem since the permissions of symbolic links are never used. However, for each symbolic link listed on the command line, chmod changes the permissions of the pointed-to file.

This might be GNU-specific, but since you're running a Linux distribution you've probably got GNU coreutils.


Not as elegant as accepted answer:

readlink -f  /dev/input/by-id/usb-Metrologic_Metrologic_Scanner-event-kbd | sudo xargs chmod 666
  • Nitpick corrected. Thanks for taking the time to respond and providing an excellent explanation. – gatorback Nov 24 '16 at 15:16

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.