Logging out of console GUI also kills any ssh sessions

Bug #1683524 reported by Nukie Nukien
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
elementary OS
New
Undecided
Unassigned

Bug Description

It seems that when you log out of the main session on the console, it will also log you out (or simply kill) any ssh sessions into the same box that may be open.

Tested in Virtualbox v5.1.18 on Ubuntu 12.04 (Pinguy)
Tested in VMWare Fusion v8.5.6 on Mac OSX Sierra

Install ElementaryOS Loki in a VM by booting the current ISO and installing to a 10G virtual disk with 4G ram and bridged networking. Selecting to install updates and 3rd party items does not alter issue, nor does fully updating system after install.

Log into the main console GUI, see the desktop, open a terminal session.
Install openssh-server via "apt-get update && apt-get -y install openssh-server"

ssh into the VM from elsewhere.
Verify a good session, and check ssh processes with "ps axf | fgrep ssh"

 2227 ? Ss 0:00 /usr/sbin/sshd -D
22801 ? Ss 0:00 \_ sshd: nukien [priv]
22837 ? S 0:00 \_ sshd: nukien@pts/0
24301 pts/0 S+ 0:00 \_ grep -F ssh

Log out of the console GUI session by clicking the Power icon in upper right, selecting "Log Out" and clicking the "Log Out" button on the "Are you sure you want to log out?" dialog.

Notice that the ssh session is killed.

The order of logging in doesn't matter - can log in via ssh before or after the console GUI. This also happens even though

KillUserProcesses=no

is uncommented in /etc/systemd/logind.conf.

This seems very similar or related to https://bugs.launchpad.net/elementaryos/+bug/1355711

Tags: loki ssh
Nukie Nukien (nukien)
tags: added: loki
tags: added: ssh
Revision history for this message
Zisu Andrei (matzipan) wrote :

Discussing this with Nukie, it seems the SSH session gets cut off by a refused connection.

Revision history for this message
Lewis Goddard (lewisgoddard) wrote :

The following occurs whether or not I log in after or before SSH, as soon as I log out in the GUI.

```
lewis@Comrade-Loki:~$ ssh Acer
lewis@acer-aspire-7740's password:
Welcome to elementary OS 0.4 Loki (GNU/Linux 4.4.0-72-generic x86_64)

 * Website: http://elementary.io/
Last login: Wed Apr 19 18:00:24 2017 from 192.168.1.74
lewis@Acer-Aspire-7740:~$ Connection to acer-aspire-7740 closed by remote host.
Connection to acer-aspire-7740 closed.
lewis@Comrade-Loki:~$
```

The following occurs with `ssh -v` after remote GUI logout.

```
lewis@Acer-Aspire-7740:~$ debug1: channel 0: free: client-session, nchannels 1
Connection to acer-aspire-7740 closed by remote host.
Connection to acer-aspire-7740 closed.
Transferred: sent 2632, received 2684 bytes, in 18.3 seconds
Bytes per second: sent 143.9, received 146.7
debug1: Exit status -1
lewis@Comrade-Loki:~$
```

Revision history for this message
Nukie Nukien (nukien) wrote :

Is there any idea what is causing the behavior ? Would be nice to be able to patch it after install, at least for now. Until a patch update comes out.

Revision history for this message
Nukie Nukien (nukien) wrote :

A bit more information ... It seems that logging out of the GUI will also force kill ANY sessions for that userid. Including any that are logged into console tty1 and tty2 for example.

What is the logout process chain ? Where would one look for what is causing this ?

Revision history for this message
Zisu Andrei (matzipan) wrote :

Best start would be to start removing packages and see which ones stop this bug from taking place? OR start with a clean ubuntu install and start installing elementary packages (perhaps in a manner similar to this one https://elementaryos.stackexchange.com/questions/241/can-i-convert-a-ubuntu-installation-to-an-elementary-installation) until you can see the problem again?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.