Ubuntu – How to allow a non-default user to use serial device ttyUSB0

permissionsttyusb

I have an Ubuntu 11.10 system with 2 users:

• The first was created during the installation
• The second instead was created after. It belongs to the sudoers group.

Now the problem is that when the second tries to use a device ttyUSB0 the following error is returned:

"Could not open serial port /dev/ttyUSB0"


I was able to fix it by using:

sudo chown :second_user /dev/ttyUSB0


However when I disconnect the device and reconnect it the problem comes back.

Is there a way to allow different users to access the devices?
I suppose I have to add the user to a specific group. Currently the owner is root and the group is dialout. However I'm not sure about the group and I don't know how to add the user.

Thanks!

As you've noticed, the /dev/ttyUSB0 device has the group of dialout. All you need to do is add the second user to the dialout group:
sudo adduser second_user dialout