How do I allow non-root access to /ttyUSB0?

Since I updated from Ubuntu 10.04 (Lucid Lynx) to Ubuntu 12.04 (Precise Pangolin), I am unable to access the device connected in /ttyUSB0 if I don't have root access.

To be more specific, I use a USB-to-serial com port converter to access and configure Cisco equipment with software called PuTTY. It happens that, since I upgraded to 12.04, PuTTY only sees the connected device when I run it as gksudo putty. If not, it says "unable to connect to port /ttyUSB0".

I have managed to change the permissions via chmod 666, and it works, but if I disconnect the USB device and reconnect, it goes back to root only. How do I permanently allow non-root access? I have a clue it might be via udev rules, but I have no idea how to do it.

Obs.: Manufacturer and drivers are "PROLIFIC"

0

10 Answers

The device is most likely attached to user group dialout. Just add your user to the dialout group so you have appropriate permissions on the device.

sudo usermod -a -G dialout $USER

(You may need to logout and back in for the new group to take effect.)

No need to mess around with permissions or udev rules.

15

It's possible this is related to modemmanager, as detailed here.

I removed that (sudo apt-get remove modemmanager) and it fixed my problem.

You still need to be in the dialout group though.

5
sudo adduser <the user you want to add> dialout
sudo reboot

Mentioned by "Try now" worked for me. Check that You have dialout as group for ttyUSB0:

ls -l /dev/ttyUSB0

in my case the output is:

crw-rw---T 1 root dialout 188, 0 Feb 12 12:01 /dev/ttyUSB0
1

This worked for me. Just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command below.

sudo adduser <the user you want to add> dialout
sudo reboot
id -Gn

Try now.

As reported by Rinzwind, start by typing:

sudo usermod -a -G dialout $USER

But that is only part of the solution, as then you must reboot the system:

sudo reboot
2

I tried both

sudo usermod -a -G dialout $USER #(worked perfectly)

And sudo chmod 666 /dev/ttyUSB0 (worked but had to type the command again)

I also removed the mode manager but did not really help. Therefore, the best command that worked for me was

sudo usermod -a -G dialout $USER

On Ubuntu 18.04 I had to add myself to the tty group.

I got hinted by the minicom command output:

minicom /dev/ttyUSB0
minicom: cannot open /dev/tty8: Permission denied
ls -la /dev/tty8
crw--w---- 1 root tty 4, 8 juil. 31 08:27 /dev/tty
2

I had this problem with /dev/ttyS0 in Mint Rosa. Adding the user to the dialout group is required but in my case the device access was restricted and I had to expand it to give r/w access to group level also.

1

On Ubuntu 18.04:

  1. sudo adduser <user> dialout
  2. Full reboot, for some reason mere logout/login is not sufficient (bug report.).
0

navigate to /etc/ folder and edit the group file add your username like this dialout:x:20:USER

worked perfect for me :)

1

You Might Also Like