Arduino only works in root
Solution 1:
As shown in the output of your ls
command, /dev/ttyUSB0
and all similart tty device files all belong to dialout
group.
crw-rw-rw- 1 root dialout 188, 0 apr 2 09:23 /dev/ttyUSB0
Thus you need to add yourself to that group via usemod
command:
sudo usermod -a -G dialout $USER
The change requires logging out and logging back in. This is a very frequent solution and I use it myself for all my development boards that require serial console.
Alternative could be setting up a udev
script that will change ownership of that file whenever it's connected, but changing group for user is preferred approach in a lot of cases
In particular, you should examine output of dmesg
to obtain the information on vendor and product id of your arduino. Then in /etc/udev/rules.d/
you could set up 50-arduino.rules
script. For instance, here's example of what I use for Altera's FPGA board:
$ cat /etc/udev/rules.d/51-usbblaster.rules
# USB-Blaster II
SUBSYSTEM=="usb", ATTR{idVendor}=="09fb", ATTR{idProduct}=="*", \
ENV{DEVTYPE}=="usb_device",MODE="0666"
Replace "09fb"
with your Arduino's vendor id. ATTR
part can reman the same. You can run chown
with RUN
argument. For instance, use `RUN=+"/path/to/chmod_script.sh root:myuser %k". See this for more info.