Remote ssh tunnel in background or script?
kdk at daleco.biz
Mon Nov 9 20:48:03 UTC 2009
Svante Kvarnstrom wrote:
> Have you tried -f (for background) and -N for "Do not execute a remote
> command"? See man 1 ssh for more details.
Cheers for you!
It was "-f" without "-N" that produced the error.
I'm guessing I got down the manpage about as far as
"-f" and didn't go any further. *beats head on desk*
For the archives:
SMTP OVER SSH TUNNEL FREEBSD
sudo ssh -f -N -L localname:24:remotename:52525 me at remotename
When SMTP is listening on "remotename" port 52525. "sudo" is needed
to open the tunnel on the "localname" side on port 24 (a privileged
port). You could do this as "root" on the local side, but shouldn't
connect *to* root on the remote computer.
> On Nov 9, 2009, at 7:30 PM, Kevin Kinsey wrote:
>> 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
More information about the freebsd-questions