[CentOS] ssh -X not shutting down

Thu Jul 30 13:54:04 UTC 2009
Filipe Brandenburger <filbranden at gmail.com>


On Thu, Jul 30, 2009 at 09:42, Anne Wilson<cannewilson at googlemail.com> wrote:
> Occasionally I ssh into my server to check something, and if it needs the gui
> I use 'ssh -X'.  Until recently there was no problem.  Exiting simply dropped
> me back to my local konsole.  Lately, though, the shutdown seems to hang, and
> I have to close the session.  Any thoughts?

This usually happens when you have a background process connected to
the tty used by your SSH session.

This usually happens when you restart a daemon ("service xxx restart"
or "/etc/init.d/xxx restart") and the script or the program does not
detach itself from the tty, which it should do if it is a proper

You can use "ps -f" (before you close the session) to see which
processes are attached to your tty, after that, if you log out the
session and it hangs, you can look into those programs that were
running on your tty and see if they are causing that.

See also: http://www.openssh.org/faq.html#3.10

If you want to force disconnection of the SSH session without having
to close the terminal or window, you can type <Return> then ~. (tilde
followed by dot), this will terminate the SSH client process.