From owner-freebsd-questions@FreeBSD.ORG Tue Nov 10 11:18:58 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 42ED2106568F for ; Tue, 10 Nov 2009 11:18:58 +0000 (UTC) (envelope-from kraduk@googlemail.com) Received: from mail-bw0-f213.google.com (mail-bw0-f213.google.com [209.85.218.213]) by mx1.freebsd.org (Postfix) with ESMTP id BC5398FC4C for ; Tue, 10 Nov 2009 11:18:57 +0000 (UTC) Received: by bwz5 with SMTP id 5so4581480bwz.3 for ; Tue, 10 Nov 2009 03:18:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=Pg09+JA7a6zRXETMNSkFBRJQUT/ZitgIXjiabDTWT3A=; b=T5fyYWipl4JawbuicuZnOphnd9MNBNhmfOUpqSkQ8GtGUhBjYAxyvksld/XEHwguVR pw2HTlsokCs/JzLYhEKT6/alDpBN1hv8fnTq+e0/JuROkcHRQWU+R7NO0kluEJbdulK2 B0Xk07wDFskshuABYyFd6n8NQdE+B107wRdLE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=eisHZ6/3QzvBz8vFMHoSH4sZblK7/wmxvEZmuElxNXjzkVd3/poxrBNR8Q44FwN1nc vRLEnOefOpfxvQ7D+fndlL20T/Ddt9ChfXW9+Bw59dUhbmigsKjox03v/E6uS+Uf9fK1 /tn8kcbIwksZDWrJow7IuIuGWlYmgKfNTUUyM= MIME-Version: 1.0 Received: by 10.239.181.148 with SMTP id m20mr928210hbg.186.1257851936497; Tue, 10 Nov 2009 03:18:56 -0800 (PST) In-Reply-To: <4AF87F39.7070403@daleco.biz> References: <4AF85FC9.10103@daleco.biz> <4AF87F39.7070403@daleco.biz> Date: Tue, 10 Nov 2009 11:18:56 +0000 Message-ID: From: krad To: Kevin Kinsey Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Svante Kvarnstrom , freebsd-questions@freebsd.org Subject: Re: Remote ssh tunnel in background or script? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2009 11:18:58 -0000 2009/11/9 Kevin Kinsey > 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