Ubuntu – Give write access to USB and Serial devices automatically

batchcommand line

I am working with some USB and Serial micro-controllers. Everytime I plug a device I have to do the following command to give it write access, and also my password:

sudo chmod 666 /dev/ttyUSB0

Can I set my Ubuntu to automatically give write access to pluged in devices?

If not, how can I make a batch file that I can easily give the access to port I want for example if I run the following command it does the job:

giveaccess -usb0

Best Answer

You should add your userid to the dialout group. Suppose your userid is joeuser, then do:

sudo adduser joeuser dialout

and then log out and log back in again for this to take effect.