This is running me crazy:

I want to use 4 screen windows (within the same session) in a remote server (GCloud) to process 4 subjects in a parallel way.

Long story short:

  1. I first create a detached session:
gcloud compute ssh server --command "screen -dmS remoteSession"
  1. And then I use the following to (remotely) add a new window to that session and start the process. The last screen -X other is to avoid screen of changing my current window (kind of create a window in a detached mode).
gcloud compute ssh server --command "screen -x remoteSession -X screen -t window1 ping google.com; screen -X other"

*In this case I added the ping command instead of the huge command I use.

The problem is that this works when I type it in the shell, but not in the script. However, it works in the script when doing it on local (just doing the commands without the gcloud compute blabla).

The remote session seems to be created just fine. But when executing the second step it just prompts No screen session found.

Any ideas?

1 Answer 1


I already found out what was happening:

Somehow when I create the session it is created in /run/screen/S-uname, but when executing the second command it looks for sessions in /run/screen/S-root (without actually using sudo in either call).

The fast answer for me was to call the first command with sudo, allowing it to create a socket in /run/screen/S-root.

For more info you could take a look on here


You must log in to answer this question.

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