76

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"

Eliah Kagan
  • 119,640
yurividal
  • 1,822

10 Answers10

164

The device is most likely attached to user group dialout.

To find out which user group the device is attached to:

stat /dev/ttyUSB0

This should produce something like

Gid: (   20/ 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.

beauxq
  • 211
Rinzwind
  • 309,379
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.

Eliah Kagan
  • 119,640
Ed.
  • 166
15
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
Aditya
  • 13,616
5

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
lboz
  • 51
3

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.

Mitch
  • 109,787
3

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
αғsнιη
  • 36,350
1

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
Laurent
  • 666
-1

On Ubuntu 18.04:

  1. sudo adduser <user> dialout
  2. Full reboot, for some reason mere logout/login is not sufficient (bug report.).
Eero Aaltonen
  • 1,424
  • 3
  • 13
  • 33
-1

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.

LesA
  • 1
-5

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

worked perfect for me :)

chaos
  • 28,186
Bane
  • 1