Remote ssh tunnel in background or script?
gibblertron at gmail.com
Mon Nov 9 19:36:52 UTC 2009
Check out /usr/ports/security/autossh
autossh is a program to start a copy of ssh and monitor it, restarting
it as necessary should it die or stop passing traffic.
The original idea and the mechanism were from rstunnel (Reliable SSH
Tunnel). With this version the method changes: autossh uses ssh to
construct a loop of ssh forwardings (one from local to remote, one
from remote to local), and then sends test data that it expects to
get back. (The idea is thanks to Terrence Martin.)
On Mon, Nov 9, 2009 at 10:30 AM, Kevin Kinsey <kdk at daleco.biz> wrote:
> I have a client who recently dropped static IP service in
> favor of a "cheaper" solution, so they're now on a DHCP network
> blocking port 25, etc.
> In order to continue to allow them to connect to an outbound
> SMTP box on the LAN, I've done this on their server:
> sudo ssh -L thisbox:24:remotebox:52525 me at remotebox
> I've got Sendmail listening there on 52525, and it works
> fine; the local clients are told to connect to "thisbox"
> port 24. The only issue is that I have to run it from
> a terminal session. When I tried to bg the process ("cmdstring &")
> it doesn't work, exactly. I've gotten an error message
> at times*, and at other times I apparently get "thisbox"
> listening on port 24 but it's not an SMTP daemon that's
> I have a feeling it's cause I'm in csh, which is notorious
> for backgrounding issues. <?> At any rate, what I'd
> like to do is have a script set up the connection, or
> write some daemon that would monitor the connection and
> fix it if it gets reset. At any rate, if I could get this
> SSH process to detach from a terminal, it'd be great.
> Any suggestions?
> Kevin Kinsey
> * I'm sorry, but I can't reproduce the error message
> this morning. IIRC, something to the effect of
> "I can't do nothing, give me a command please?"
> freebsd-questions at freebsd.org mailing list
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"
More information about the freebsd-questions