77

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,820
yurividal
  • 1,832
  • Even with dialout group set up, PuTTY may only work with sudo if the font defaults to server:fixed so try setting this to Monospace before connecting – theSparky Feb 01 '25 at 22:56

10 Answers10

165

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
  • 4
  • 13
Rinzwind
  • 310,127
  • 3
    no success... still no acces to ttyUSB0 without root... any other ideas??? – yurividal May 11 '12 at 16:16
  • Great, works fine for me.. thanks! sudo usermod -a -G dialout pier – lppier Sep 02 '14 at 02:51
  • 1
    @tom-hennen I guess you should add it first as a comment rather than edit it directly. – MadMike Oct 29 '14 at 13:33
  • 3
    This doesn't work for Debian – Mike May 16 '15 at 16:51
  • @mike that is why we do not support debian ;) and in 2012 this did work for Ubuntu. – Rinzwind May 16 '15 at 17:20
  • @Rinzwind It was just a comment. I wasn't complaining or anything. – Mike May 16 '15 at 17:23
  • This worked perfect for me using Linux Mint, thanks! – Nate Oct 02 '16 at 05:52
  • 2
    Kudos for including "may need to logout and back in". – Rob Stoecklein Jul 26 '18 at 13:57
  • 4
    In Ubuntu (I'm on 18.04), logout/login doesn't work. we have to reboot after doing usermod. – Sujay Phadke Mar 02 '19 at 06:42
  • 1
    Using newgrp dialout is enough to test the new permission in a shell, without having to logout. – Tey' Mar 19 '20 at 16:35
  • With Kali linux after that I can only read from serial port, but not write. – ltWolfik Dec 23 '21 at 15:11
  • UPD: The problem was - for another user (non-root) the minicom was set up incorrectly. – ltWolfik Dec 23 '21 at 15:28
  • For some reason this didnt work for me... I'm on Ubuntu 22.04. What i did was a crontab that runs every minute that does the command chmod 777 /dev/ttyS0 ... – Raul Chiarella May 11 '22 at 14:09
  • 1
    @RaulChiarella no please no. ANYONE even from the outside could address this device. If the owner is not dialout change my command to what group is is; the method I posted -must- work cuz that is how groups work. If you do stick to chmod do 770 never 777. – Rinzwind May 11 '22 at 18:30
  • Oh... But there is'nt anything i can do, besides, the system doesnt connect at all to the internet. Its a local system only that uses only local connection to connnect to local servers... – Raul Chiarella May 11 '22 at 23:44
  • This answer should show up when googling for 'FTDI ubuntu not working', or 'FTDI ubuntu permission denied'. Would have saved me an hour :). – bas Sep 01 '22 at 18:52
  • The answer would be better if it included a way to check to see what user group the device is attached to. – beauxq Oct 12 '22 at 18:11
16

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,820
Ed.
  • 176
  • 2
    What if I can't remove modemmanager? I have a friend that has a 3G modem, and it seems he can't remove modemmanager because of that. How can he access /ttyUSB0 on 12.04 without root, but without removing modemmanager? – Leonardo Montenegro Jul 19 '13 at 12:22
  • You can try by stopping it? sudo stop modemmanager It worked for me. – Aleks Aug 12 '14 at 09:19
  • Been a few years, but this is still the case in Ubuntu 17.10. Had to do a sudo apt-get purge modemmanager before sudo usermod -a -G dialout $USER had the desired effect. – Stéphane Nov 06 '17 at 03:29
  • 2
    Please note: being in dialout group is sufficient if you do not use modemmanager in any way. The modemmanager removal is very case-specific to OPs situation, and is not a requirement every time. – Sergiy Kolodyazhnyy Dec 15 '19 at 01:44
  • Thank you bro. That solved my problem. I got access denied fron non-root user while the permission of /dev/ttyUSB0 was 777 ! – SuB Aug 01 '21 at 07:29
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,626
  • in Linux Mint 18 Cinnamon I get this error when calling ' ls -l /dev/ttyUSB0 ' ls: cannot access '/dev/ttyUSB0': No such file or directory – flyingdrifter Dec 08 '16 at 22:56
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
    I had to reboot to get this to work. A Logoff didn't propagate the change. – user1182988 Jun 03 '19 at 20:19