From owner-freebsd-questions@FreeBSD.ORG Mon Nov 9 18:34:03 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 6EAFB106566B for ; Mon, 9 Nov 2009 18:34:03 +0000 (UTC) (envelope-from kdk@daleco.biz) Received: from ezekiel.daleco.biz (southernuniform.com [66.76.92.18]) by mx1.freebsd.org (Postfix) with ESMTP id 1EC0D8FC23 for ; Mon, 9 Nov 2009 18:34:02 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by ezekiel.daleco.biz (8.14.3/8.14.2) with ESMTP id nA9IXPNx076215 for ; Mon, 9 Nov 2009 12:33:40 -0600 (CST) (envelope-from kdk@daleco.biz) X-Virus-Scanned: amavisd-new at daleco.biz Received: from ezekiel.daleco.biz ([127.0.0.1]) by localhost (ezekiel.daleco.biz [127.0.0.1]) (amavisd-new, port 10024) with LMTP id g40QxsyApaEN for ; Mon, 9 Nov 2009 12:31:50 -0600 (CST) Received: from archangel.daleco.biz (ezekiel.daleco.biz [66.76.92.18]) by ezekiel.daleco.biz (8.14.3/8.14.3) with ESMTP id nA9IUXuW076149 for ; Mon, 9 Nov 2009 12:30:49 -0600 (CST) (envelope-from kdk@daleco.biz) Message-ID: <4AF85FC9.10103@daleco.biz> Date: Mon, 09 Nov 2009 12:30:33 -0600 From: Kevin Kinsey User-Agent: Thunderbird 2.0.0.23 (X11/20090929) MIME-Version: 1.0 To: freebsd-questions Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: 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: Mon, 09 Nov 2009 18:34:03 -0000 Greetings! 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@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 * 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?"