You are not logged in.

#1 2013-03-26 22:47:35

rwd
Member
Registered: 2009-02-08
Posts: 664

can't resume 'screen' sessions when sshd.socket service is enabled

I enabled the sshd.socket systemd service to solve an issue with sshd.service failing at boot because it wouldn't wait for the network to come up. However enabling this service seems to have caused a another problem:

I used to ssh into my home server and use  'screen' to leave the remote terminal sessions running so I can resume them later. WIth sshd.socket on the server enabled,  if I close the terminal window or log out, then ssh back in to the server and issue 'screen -list' I see no sessions running.  I assume sshd.socket creates and kills sshd processes and this interferes somehow with screen. Any idea how to use both sshd.socket and be able to resume screen sessions?

Last edited by rwd (2013-03-26 22:56:35)

Offline

#2 2013-03-26 22:50:43

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: can't resume 'screen' sessions when sshd.socket service is enabled

I honestly don't see why this would interfere with screen. I use tmux, so cannot comment specifically, but it does not kill my tmux session... though I have created a tmux@.service that starts me a tmux session that starts teh daemon and creates a session for my user on boot.

Offline

#3 2013-03-26 23:09:02

rwd
Member
Registered: 2009-02-08
Posts: 664

Re: can't resume 'screen' sessions when sshd.socket service is enabled

I checked again: disabled and stopped sshd.socket, enabled and started sshd.service, I ssh in and I can resume screen. Then the other way around, and I can't resume anymore. I guess I could use a service to keep screen going, just like I have for rtorrent daemon. But I tend to start different screen sessions at once for different tasks depending on what I'm doing. I'm going to give tmux a go but screen has worked fine for me so far.

Last edited by rwd (2013-03-26 23:12:37)

Offline

#4 2013-03-26 23:13:32

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: can't resume 'screen' sessions when sshd.socket service is enabled

If you use the networkmanager-wait-online.service, you can presumably have sshd.service be "After=" that so that it gets a notification that the network is up before starting.

Or you can use something like netcfg@.service, which does not actually complete until an IP address ahs been issued and accepted by dhcp.  Then add "After=netcfg@wlan0.service" to the [Unit] of sshd.service.


Edit: Remind me again if we are talking about wired or wireless?

Last edited by WonderWoofy (2013-03-26 23:13:57)

Offline

#5 2017-04-16 14:08:45

enihcam
Member
From: Internet
Registered: 2009-12-20
Posts: 220

Re: can't resume 'screen' sessions when sshd.socket service is enabled

If your processes get killed at the end of the session, it is possible that you are using socket activation and it gets killed by systemd when it notices that the SSH session process exited. In that case there are two solutions. One is to avoid using socket activation by using ssh.service instead of ssh.socket. The other is to set KillMode=process in the Service section of ssh@.service.

The KillMode=process setting may also be useful with the classic ssh.service, as it avoids killing the SSH session process or the screen or tmux processes when the server gets stopped or restarted.

Offline

Board footer

Powered by FluxBB