I'm trying to communicate with an Arduino from Ubuntu 12.04. When plugging in the USB cable, the arduino's serial port occurs as /dev/ttyUSB0. When I try to connect to it using moserial, I'm getting an "Could not open device /dev/ttyUSB0" error, but not when I launch moserial using sudo. What I have to configure to make the serial device accessible as normal non-root user?
Linux – Configure permissions for /dev/ttyUSB0
linuxpermissions
Best Answer
You have several options:
Automatic ACL assignment
You most likely have systemd-logind or ConsoleKit running in Ubuntu, which can automatically configure ACLs on device nodes based on which user account is currenty logged in at the console. These ACLs grant access additionally to the usual permissions and can be seen using
getfacl
.To use this, add the following to
/etc/udev/rules.d/60-extra-acl.rules
1:(1Yes, create the file. It doesn't exist by default; the whole directory is for admin customizations.)
Group-based access
The tty devices are usually readable/writable by a specific group such as "dialout" or "uucp". Add yourself to that group to gain access to all serial ports:
Don't forget to log out & log in again so that group changes get applied.
Permission or ownership changes
udev rules similar to above can also be used to set the "main" owner & group as well as the permissions (which is how the default group got set in the first place). For example:
You can assign to OWNER, GROUP, and MODE parameters.
Temporary manual change
To do a one-time change, just use
chmod
and/orchown
as you normally would.