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:
KERNEL=="ttyUSB[0-9]*", TAG+="udev-acl", TAG+="uaccess"
(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:
# gpasswd -a YourUsername dialout
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:
KERNEL=="ttyUSB[0-9]*", OWNER="YourUsername"
or: KERNEL=="ttyUSB[0-9]*", GROUP="users", MODE="0660"
or: KERNEL=="ttyUSB[0-9]*", MODE="0666"
You can assign to OWNER, GROUP, and MODE parameters.
Temporary manual change
To do a one-time change, just use chmod
and/or chown
as you normally would.
# chown YourUsername /dev/ttyUSB0
or: # chmod a+rw /dev/ttyUSB0
2019 update: Apparently the original udev rule had a syntax error in it, and no one noticed it in 7 years, not even the people who upvoted it... – user1686 – 2019-05-03T09:43:14.010