14

When I try to run screen as a non-root user I get:

screen

[screen is terminating]

immediately, though it works fine for root

ls -alh /usr/bin/screen
-rwxr-sr-x 1 root screen 465K Jun  9 20:30 /usr/bin/screen

When googling around I noticed a mention of /etc/fstab, here is mine:

# <file system> <mount point>   <type>  <options>       <dump>  <pass>
/dev/md1        /       ext4    errors=remount-ro       0       1
/dev/md2        /home   ext4    defaults        1       2
/dev/sda3       swap    swap    defaults        0       0
/dev/sdb3       swap    swap    defaults        0       0
proc            /proc   proc    defaults                0       0
sysfs           /sys    sysfs   defaults                0       0
tmpfs           /dev/shm        tmpfs   defaults        0       0
devpts          /dev/pts        devpts  defaults        0       0

This on a freshly installed centos 7 on a dedicated server accessed through ssh ( TTY is pts )

Any help would be appreciated.

screen -ls    
No Sockets found in /var/run/screen/S-user.

ls -la /var/run/screen/S-user
total 0
drwx------ 2 user user 40 Jul 10 18:23 .
drwxrwxr-t 4 root     screen   80 Jul 10 17:59 ..
  • Run screen -ls; it should give a directory name in the first line. Then, run ls -la <above directory name> and put the output in your question. – BenjiWiebe Jul 11 '14 at 2:11
  • Ok, added it to the question. – Rob Jul 11 '14 at 3:05
  • Hmmmm...I expected to see a permissions problem there, but it looks fine. – BenjiWiebe Jul 11 '14 at 3:32
  • I am trying to get a VM of CentOS 7 going to see if it also has this problem, but I might not get it done til tomorrow... – BenjiWiebe Jul 11 '14 at 3:37
  • Is there a reason you need CentOS 7? It seems that perhaps it is related to the fact that CentOS 7 was just released. Perhaps you could use CentOS 6 for a few more weeks? – BenjiWiebe Jul 11 '14 at 19:32
12

I had this issue on Dedicated CentOS 7 server, and came across the fix described in this bug report: bugs.centos.org/view.php?id=7395

That was a fine solution on the Dedicated to add gid=5 to devpts in fstab. screen now works as expected for all users.

However, I ran across this thread as I was trying to solve the issue on an OpenVZ container of CentOS 7. As there isn't a way to edit the fstab for the server (as far as I could find), I found the following work-around fixed it.

I figured I would drop back by this way and see if it might help anyone else out. (Albeit isn't a very pretty way of doing it.)

In terminal:

chmod u+s /usr/bin/screen
chmod 755 /var/run/screen
  • This answer solved the issue for me, Ubuntu 18.04 running on openvz container – user1330614 Dec 27 '18 at 22:49
3

Ensure no other screen is using that device

This can be achieved with How can I determine what process has a file open in Linux? :

sudo lsof /dev/ttyS0

And then kill that process if that is the case.

For some reason, under this condition, sudo screen can still access the device, but then that connection will miss characters, which are consumed by the other screen.

Ensure the user has read and write permission to the file

E.g. on Ubuntu you want to add the user to the dialout group: https://askubuntu.com/a/133244/52975

  • 1
    thanks for lsof, I didn't know that I already have two screens running in the background – Marecky Dec 24 '17 at 0:02
-2

It might be an errors in your config file

~/.screenrc

Try to check it or create dimmy one.

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.