How to run screen on a Linux host reporting “Cannot make directory ‘/var/run/screen’: Permission denied”?
Posted on In QAI want to run screen
on a remote host on which I do not have root/sudo privilege and screen
is not installed.
I can compile or copy the screen
program that can run on the host. However, it reports:
“Cannot make directory ‘/var/run/screen’: Permission denied”
As screen is not installed on the host, the directory var/run/screen/
does not exist.
How to run screen on a Linux host without requiring root privilege?
The directory /var/run/screen/
is the socket directory for screen
.
Fortunately, screen
reads a environment variable SCREENDIR
to get an alternative socket directory.
So to work around it, you can create a directory, such as ~/.screen
:
mkdir ~/.screen && chmod 700 ~/.screen
and export the SCREENDIR
to point to that directory:
export SCREENDIR=$HOME/.screen
You can also put this line into you ~/.bashrc
so that it will also take effect afterwards.