Linux – “screen is terminating” for non-root

centoscentos-7gnu-screenlinux

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 ..

Best Answer

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
Related Question