Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Nov 2009 11:18:56 +0000
From:      krad <kraduk@googlemail.com>
To:        Kevin Kinsey <kdk@daleco.biz>
Cc:        Svante Kvarnstrom <sjk@ankeborg.nu>, freebsd-questions@freebsd.org
Subject:   Re: Remote ssh tunnel in background or script?
Message-ID:  <d36406630911100318n65f775nb64eeeb075f680a6@mail.gmail.com>
In-Reply-To: <4AF87F39.7070403@daleco.biz>
References:  <4AF85FC9.10103@daleco.biz> <F2652639-EACC-44FB-858D-D4153FA8D055@ankeborg.nu> <4AF87F39.7070403@daleco.biz>

next in thread | previous in thread | raw e-mail | index | archive | help
2009/11/9 Kevin Kinsey <kdk@daleco.biz>

> Svante Kvarnstrom wrote:
>
>> Hello
>>
>> Have you tried -f (for background) and -N for "Do not execute a remote
>> command"? See man 1 ssh for more details.
>>
>> Svante
>>
>
> 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*
>
> Thanks, Svante!
>
> For the archives:
>
> SMTP OVER SSH TUNNEL FREEBSD
>
>  sudo ssh -f -N -L localname:24:remotename:52525 me@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:
>>
>>  Greetings!
>>>
>>>
>>> sudo ssh -L thisbox:24:remotebox:52525 me@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
>>> listening.
>>>
>>> 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
>>>
>>>
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "
> freebsd-questions-unsubscribe@freebsd.org"
>

if you put it on a port > 1024 instead of 24 you wont need to run it as root
so can drop the sudo bit



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?d36406630911100318n65f775nb64eeeb075f680a6>