Any workarounds for SSH hang issue?

Jeremy Nickurak jeremy at nickurak.ca
Tue Jul 27 15:48:16 EST 2010


If all you want to do is ensure that the ssh connection terminates when the
command you specify exits, here's what I'm doing, specifically to have a
system inside a VM display its login session on the host's X server:

ssh -X host "/etc/X11/Xsession; kill \$PPID"

In this case, the $PPID (with backslash) gets replaced with the pid of the
parent process running the commands, specifically, the user's sshd process.
Kill that, and the whole thing shuts down.

In this case, it's intended to behave the same way an Xinitrc script works.
When the last command in an Xinitrc script executes, the X server shuts
down, and any processes left lose their connection.

On Mon, Jul 26, 2010 at 02:55, Ervin Yan <Ervin_Yan at symantec.com> wrote:

> Hi,
>
>
>
> Recently, I got some problems that my program is very easy to hang when
> call ssh commands in a forked process on unix platforms.
>
>
>
> And I understand that it maybe a tricky issue for ssh according to the
> following FAQs:
>
> http://www.snailbook.com/faq/background-jobs.auto.html
>
> http://www.openssh.org/faq.html#3.10
>
>
>
> My question is:  do we have any workarounds so that ssh do not hang
> there.  We do not care the data loss cases.
>
>
>
> I would really appreciate if you could give me some ideas to solve this
> issue.
>
>
>
> Thanks,
>
> Ervin.
>
>
>
> _______________________________________________
> openssh-unix-dev mailing list
> openssh-unix-dev at mindrot.org
> https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
>



-- 
Jeremy Nickurak -= Email/XMPP: -= jeremy at nickurak.ca =-


More information about the openssh-unix-dev mailing list