0

Everywhere I look I see that screen is for keeping a session open so that you can come back to it after disconnection. But this doesn't seem to be the case for a system that I ssh to. Do I understand correctly, that the sysadmins have crippled nohup and screen? Is there a way to circumvent this?

Here is a test I did (perhaps the problem is me):

mira1:~> screen -S test  COMMENT: I did ctrl-a ctrl-d
[detached from 54211.test]
mira1:~> logout
Connection to mira1.**** closed.
me:~ me$ ssh me@mira1.***

Last login: Tue Feb  9 23:21:57 2016 from client*****
mira1:~> screen -ls
No Sockets found in /var/run/screen/S-me.

Edit: The screen is still there after detaching it and before logging out. As in:

mira1:~> screen -S test
[detached from 59923.test]
mira1:~> ls -ltr /var/run/screen/S-me/
total 0
prw------- 1 me URP_dse 0 Feb  9 23:39 59923.test
mira1:~> 

Edit 2 for Gile's questions: Here is ssh session #1

mira1:~> screen -ls
There is a screen on:
    59923.test  (09/02/16 23:39:26) (Detached)
1 Socket in /var/run/screen/S-me.

mira1:~> screen -r
[detached from 59923.test]

ssh session #2

mira1:~> screen -ls
There is a screen on:
    59923.test  (09/02/16 23:39:26) (Detached)
1 Socket in /var/run/screen/S-me.

ssh sesssion #1 again

mira1:~> logout
Connection to mira1.**** closed.
client-10-129-225-10:~ me$ 

ssh session #2 again (screen gone)

mira1:~> screen -ls
No Sockets found in /var/run/screen/S-me.
  • 1
    Show us ls -ltr /var/run/screen/ after you detach the screen. – MAQ Feb 09 '16 at 23:37
  • 1
    If you start two SSH sessions, start screen in one, detach and log out from that session, can you still attach to the screen in the other session? If you can't, what happens if you first attach in the second session, then log out from the session where you started screen? What kind of system is it? What shell are you using, is there anything in .logout or .bash_logout or whatever applies to your shell? – Gilles 'SO- stop being evil' Feb 09 '16 at 23:43
  • Gilles I'll look into those. meantime, why does it say "total 0" when there is 1 item in the list? total 0 prw------- 1 me URP_dse 0 Feb 9 23:39 59923.test – Alejandro Erickson Feb 09 '16 at 23:45
  • system is Debian GNU/Linux 8.2 (jessie). .logout contains source X, where X is an empty file. – Alejandro Erickson Feb 09 '16 at 23:55
  • Related questions are https://unix.stackexchange.com/questions/493024/ and https://unix.stackexchange.com/questions/345292/ . – JdeBP Jan 07 '19 at 17:06

1 Answers1

1

It's possible that screen's autodetach feature is turned off:

autodetach on|off
Sets whether screen will automatically detach upon hangup, which saves all your running programs until they are resumed with a screen -r command. When turned off, a hangup signal will terminate screen and all the processes it contains. Autodetach is on by default.

Assuming that the setting is not in your $HOME/.screenrc, the place to look would be in the system's file, e.g., /etc/screenrc.

Another possibility is that the remote machine is configured (in /etc/ssh/sshd_config) to disconnect idle users. See for example

But in that case, there is not much that you could do about it.

Thomas Dickey
  • 76,765