I am having trouble with screen. It keeps terminating every time I try to console into my routers.

eric@pop-os:~$ screen /dev/ttyUSB0
[screen is terminating]

eric@pop-os:~$ screen /dev/ttyUSB0
[screen is terminating]

It only works as root or superuser.


Does your user account eric have the permission to use /dev/ttyUSB0? To find out, please run ls -l /dev/ttyUSB0. The output might look like this:

$ ls -l /dev/ttyUSB0 
crw-rw----+ 1 root dialout 166, 0 Jul  9 08:55 /dev/ttyUSB0

The characters at the left-most column are the file type and permissions information:

  • The first character is c, indicating a character-based device.
  • The last character is +, indicating that there is an Access Control List (ACL for short) on this device node, specifying further access rules. This is important, because it changes how the other permissions are interpreted.
  • The characters 2-4 are a three-letter group rw- indicating permissions for the file owner, which is root as indicated in the third column.
  • The second group of three letters (rw- again) would classically indicate permissions applicable to the group of users the file is assigned to. In this case, the group is dialout as indicated in the fourth column. But because this file has an ACL, the meaning is different: with an ACL in effect, it just indicates the highest permissions granted to a specific user or group that is not the file owner - but you cannot know which user or group it is.
  • The third group of three letters (---) indicate access permissions for everyone else - if it's all dashes, it means no access is allowed.
  • The last character is +, indicating that there is an Access Control List (ACL for short) on this device node, specifying further access rules.

Lastly, the ACL can be viewed with getfacl /dev/ttyUSB0. The output might look something like this:

$ getfacl /dev/ttyUSB0 
getfacl: Removing leading '/' from absolute path names
# file: dev/ttyUSB0
# owner: root
# group: dialout

Basically, it repeats the traditional non-ACL file permissions and allows specifying extra permissions for any number of users and groups. In this case, there is an extra line user:sddm:rw- indicating both read and write access to user sddm, which is the user account the GUI login manager process sddm is currently running as. And there's also the group::rw- line that confirms that the classic dialout group has full read/write access to this file - this information was hidden from the classic ls -l output when an ACL was applied to this device node.

The fact that an ACL grants permissions to sddm indicates that this OS is probably configured to automatically grant access to local serial ports if you log in locally using the GUI login dialog. The ACL would be automatically changed to match the logged-in user, and back to sddm when the user logs out. If such an ACL is not present, then your distribution might not use such an automatic permissions mechanism.

The group name dialout is historical, because serial ports used to be used with modems. But if a device is assigned to a special group like this, it indicates the distribution is probably configured to manage access to serial ports using the dialout group. So in this example, you might want to add your user account to the dialout group. You'll need root/superuser access to do that:

# usermod -a -G dialout eric

New group memberships take effect at next login, so you'll need to log out and back again.

Because the /dev filesystem is a virtual, RAM-based filesystem, all the device nodes are created from scratch every time the system boots. Because of this, trying to change the permissions of the actual device nodes would be futile; your changes would be forgotten when you shut down the system. Instead, the default permissions for the devices use specific groups, for the express purpose of allowing the administrators to use group memberships to grant specific users access to specific types of devices: using those groups as intended is probably the easiest way to solve your problem.

  • here is my ls output ls -l /dev/ttyUSB0 crw-rw---- 1 root dialout 188, 0 Jul 9 13:33 /dev/ttyUSB0 – Eric Jul 10 '19 at 0:02
  • i got it to work i used that user-mod command and i reinstalled screen. i got it to work. i had to reinstall it because it keep saying to run screen with permission numbers 755 then i changed it then it says to change it to 700 and when i changed it to 700 it says to change it back to 755 why that happened i don't. know – Eric Jul 10 '19 at 0:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.