I want to access a USB device ttyUSB0 from apache. So I set:

chgrp www-data /dev/ttyUSB0

The problem is, that every time I replug the device, I have to set to do chgrp again. How can I do this?

  • 1
    usually, /dev/ttyUSBx has group dialout attached, so you might add user ẁww_datato group dialout: sudo adduser www_data dialout
    – ridgy
    Commented Jan 23, 2017 at 21:31
  • @ridgy sorry, did not solve it. After replugging the USB device, www-data still couldn't access it
    – black
    Commented Jan 23, 2017 at 21:39

1 Answer 1


I think that the best solution would be to add a rule to etc/udev/rules.d you will find tons of tutorial on how to do it. Use lsusb or dmesg to discover pid and id of your usb than create the file/rule with your text editor and with sudo mv move it in that folder

  • Ok i understood (and i discovered how to do it on my own) ! Thanks for correcting my spelling mistake in the directory
    – aster94
    Commented Apr 8, 2017 at 7:49
  • 1
    Always glad to help. You might wish to expand your answer with some detail and site one of the tutorials you mention as a source. Better answers receive upvotes that will boost your reputation here.
    – Elder Geek
    Commented Apr 8, 2017 at 13:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .