Running "Screen" Without Additional Permissions on Wsl

Running "Screen" Without Additional Permissions on Wsl

I'm trying to run the "screen" utility on Windows Subsystem for Linux on Windows 10 (Version 1703, OS Build 15063.483).

It seems that I need additional permissions to run it (it works if I "sudo" it), but I don't understand why that is necessary.

What is the recommended way to set this up?

Is there some reason why this isn't the default set up?

$ screen
Cannot make directory '/var/run/screen': Permission denied
2

4 Answers

From an answer on SuperUser I discovered that you have to run

sudo /etc/init.d/screen-cleanup start

Then screen works fine for me.

2

EDIT: after installing Ubuntu 20.04 the problem went away (*).

As Krease pointed out, the best solution is the one described in this SuperUser post.

Add the following to your .bashrc:

export SCREENDIR=$HOME/.screen
[ -d $SCREENDIR ] || mkdir -p -m 700 $SCREENDIR

See also issue 1245 on github.

--

(*) now this warning comes up, but seems harmless:

sleep: cannot read realtime clock: Invalid argument
4
sudo screen             # which creates dir /var/run/screen 
chmod 777 /var/screen   # so that non-root users can create their own screen dir in this dir.

/run and all its sub directories are created and managed by systemd at boot time. From version 0.67.6, WSL can launch systemd at boot time ()

Check your WSL version and enable systemd by adding the following lines in /etc/wsl.conf

[boot]
systemd=true

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Alexander Ross
Author

Alexander Ross

Alexander Ross has covered the video game industry for a decade, writing deep dives on game design, esports tournaments, VR developments, and gaming culture.