Re: Detach ssh from bash in Cygwin?
From: Nico Kadel-Garcia (nkadel_at_comcast.net)
Date: 03/26/04
- Next message: Cole Tuininga: "Re: CVS without a shell"
- Previous message: Nico Kadel-Garcia: "Re: Error: "Cannot initialize SFTP protocol. Is the host running a SFTP server?""
- In reply to: Duncan Murdoch: "Detach ssh from bash in Cygwin?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Fri, 26 Mar 2004 09:06:19 -0500
"Duncan Murdoch" <google@murdoch-sutherland.com> wrote in message
news:39e63e9b.0403251144.12e5d61f@posting.google.com...
> I'm using OpenSSH in Cygwin under WinXP. I can set up POP3 port
> forwarding (for Forte Agent) from within the bash shell in Cygwin, but
> when I close the bash window, it shuts down the ssh process that is
> doing the forwarding for me.
>
> This doesn't happen with ssh-agent; that process keeps running after
> the bash window closes.
>
> Is there a way to detach the ssh process from the shell so I can close
> the window without killing it?
>
> I think I've tried all combinations of putting an & at the end of the
> ssh command line, and putting a -f option in it, so far with no luck.
>
> For example, here's a command line I've tried:
>
> ssh -N -f -L 2110:mailhost.com:110 dmurdoch@mailhost.com &
>
> This installs the tunneling and things work fine until I try to close
> the window with "exit"; then the window won't close until I click on
> the frame to close it, at which time Windows says "Windows cannot
> close this program ....", and if I tell it to "End now", the ssh
> process goes away too.
This is a relatively new behavior of SSH (last few years), and a really good
one. If you try to exit the shell and the remote programs are still talking
to stdin, stdout, and stderr, someone else may be able to grab those
pointers by various means. So ending the session kills everything talking to
those ports.
Try this instead:
ssh -N -f -L 2110:mailhost.com:110 dmurdoch@mailhost.com >/dev/null
2>/dev/null </dev/null &
This connects all your local output and input to /dev/null, where it's
safely cast into the void.....
- Next message: Cole Tuininga: "Re: CVS without a shell"
- Previous message: Nico Kadel-Garcia: "Re: Error: "Cannot initialize SFTP protocol. Is the host running a SFTP server?""
- In reply to: Duncan Murdoch: "Detach ssh from bash in Cygwin?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|