11

After running X programs over SSH, SSH doesn't terminate after shell exit (have to use e.g. CtrlC to kill it).

My guess is although the X program already exit, there is still some "connection" left (not freed). The exceptions I have found now are gtk-demo and acroread.

Does anyone know the reason? Is this a problem with ssh{,d} configuration?

4
  • 1
    You can test this for yourself. Run ssh with -v and it will report X11 connections that are opened and closed.
    – Kyle Jones
    Feb 6, 2012 at 18:26
  • @KyleJones THX, seems that this is the problem (two "connections" freed after C-c is pressed).
    – yuyichao
    Feb 6, 2012 at 18:37
  • I`ve got the same problem on SLES11 with any X11-window. How did you trace to down to dbus?
    – Nils
    Feb 7, 2012 at 20:55
  • You can simply check the process running as you (if there is no other active sessions). I use systemd and has enabled it in sshd (pam setting), so all the process in the ssh session is in the same cgroup, which makes it really easy to check.~~
    – yuyichao
    Feb 7, 2012 at 21:01

1 Answer 1

5

Starting the X program probably starts a background process that doesn't terminate when you close the program (or the program itself doesn't terminate properly). See here for an explanation of what happens.

To fix this, you can try to find out what processes are still running and either prevent them from being started when you log in via SSH or simply kill them before you log out. You can certainly just kill the SSH connection once you have logged out as well though.

3
  • K, the problem is dbus(gconf) process is still running. (thanks to systemd-cgls~~) (I tried to killall -KILL the program itself thinking it might fork some background process before but that doesn't seems the case.). So is there a way to do things well? (e.g. kill dbus(gconf) automatically) THX
    – yuyichao
    Feb 6, 2012 at 18:42
  • 1
    You could put killall dbus or something like that in your .logout, but that would probably mess up other things (i.e. when you're logged in locally). Feb 6, 2012 at 19:00
  • Hmm, seems I need to do this manually (i.e. no direct option for that). At least I am already using kill-session=1 and hopefully systemd can tell me which is the right process to kill (i.e. not killing processes in other sessions.)~~~ THX
    – yuyichao
    Feb 6, 2012 at 19:35

You must log in to answer this question.

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