I'm trying to access an ESP32 microcontroller connected via USB to /dev/ttyUSB0 on my Kubuntu 18.04 machine, but I'm getting a permission denied error:
SerialException: [Errno 13] could not open port /dev/ttyUSB0: [Errno 13] Permission denied: '/dev/ttyUSB0'
My username is in the dialout group in both /etc/group and /etc/gshadow and I have rebooted since adding the dialout group membership.
$ sudo grep dialout /etc/group /etc/gshadow
/etc/group:dialout:x:20:steve
/etc/gshadow:dialout:*::steve
$ id -Gn steve
steve adm dialout cdrom sudo dip plugdev lpadmin sambashare vboxusers libvirt libvirt-qemu libvirt-dnsmasq
$ groups steve
steve : steve adm dialout cdrom sudo dip plugdev lpadmin sambashare vboxusers libvirt libvirt-qemu libvirt-dnsmasq
The ownership and permissions of the /dev/ttyUSB0 file are:
crw-rw---- 1 root dialout 188, 0 Nov 17 22:34 /dev/ttyUSB0
So I would expect the dialout group membership to work.
When I change the permissions on /dev/ttyUSB0 to '666', giving world read/write access, I can access the serial port:
crw-rw-rw- 1 root dialout 188, 0 Nov 17 22:34 /dev/ttyUSB0
Although usable as a solution, access should work for dialout group members, but, based on my experiments above, it seems that the dialout group membership is somehow ineffective.
This question is related to Serial port permission denied for non-root user with dialout group privileges even after reboot Ubuntu 18.04, but with some extra points.