158 Words

Allow a user to access serial (TTY) devices

On Ubuntu, create the user and add them to the dialout group. dialout normally grants access to serial devices such as /dev/ttyUSB0, /dev/ttyACM0 and /dev/ttyS0.

# Create the user
sudo adduser username

# Allow access to serial/TTY devices
sudo usermod -aG dialout username

Check:

groups username

You should see something like:

username : username dialout

The user needs to log out and back in before the new group membership takes effect.

Check a particular /dev/tty* device

For example:

ls -l /dev/ttyUSB0

Typically:

crw-rw---- 1 root dialout ... /dev/ttyUSB0

So membership of dialout is sufficient.

If you mean all /dev/tty* devices, including physical consoles such as /dev/tty1, it’s slightly different. Those are often owned by the tty group:

ls -l /dev/tty1

You can add the user to that group too:

sudo usermod -aG tty username

For serial hardware, though, I’d stick with dialout only unless you specifically need console TTY access.