4

I am trying to run an application as a systemd service inside a screen container.

When trying to start the service it fails with the error message:

screen[11648]: Directory '/run/screen' must have mode 777.

It looks like a simple error with a simple solution. When I change the permissions of /run/screen accordingly the service starts without problem.

But now when I try to attach the screen session (or run screen in any way as a normal user or as root) I get the error message.

Directory '/run/screen' must have mode 775.

Changing permissions obviously lets me run into the first error again and from there I could play cat and mouse with screen all day.

Screen version 4.05.00 (GNU) 10-Dec-16

The operating system is Debian 9 (server).

Is this a bug or am I doing something wrong? In any case, how do I get it to work?

1
  • I have exactly the same problem.
    – kounoupis
    Mar 24, 2020 at 13:20

2 Answers 2

1

I had the same problem trying to setup a minecraft server under systemd on Debian 9. No fix that I know of but here's a partial work-around. I added these lines to the unit configuration file:

PermissionsStartOnly=true
ExecStartPre=/bin/chmod 777 /run/screen

So this will adjust the permissions as needed for the service to start. And I can set the permissions back to 775 whenever I need to use screen for myself.

0

Change NoNewPrivileges=true to NoNewPrivileges=false (or add that line if it doesn't exist in the [Service] section). This will allow screen to run in setgid mode, like it usually does, so it won't ask for 777 permissions.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .