Running "screen" without additional permissions on WSL

Viewed 15663

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
3 Answers

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