Question: Getting permission “error: cannot access /dev/ttyUSB0”
Answer: Just open terminal (Ctrl+Alt+T) and type this command and enter root password
$ sudo usermod -a -G dialout ${USER}
On Linux (Ubuntu), Arduino IDE will not be able to upload sketches (or communicate with the board at all) if you don’t change permissions on /dev/ttyUSB0 appropriately. Same as with the NodeMCU ESPlorer IDE, etc. Actually, this very problem comes up whenever you want to access a (virtual) Serial COM port on Linux.
It might happen that when you upload a sketch – after you have selected your board and serial port -, you get an error Error opening serial port … If you get this error, you need to set serial port permission.
Open Terminal and type:
$ ls -l /dev/ttyUSB*
you will get something like:
crw-rw---- 1 root dialout 188, 0 5 apr 23.01 ttyUSB0
The “0” at the end of USB might be a different number, or multiple entries might be returned. The data we need is “dialout” (is the group owner of the file).
Now we just need to add our user to the group:
$ sudo usermod -a -G dialout ${USER}
NOTE: where USER is NOT your linux user name keep as it is.
In some cases, You will need to log out and log in again for this change to take effect.