Date: Tue, 21 Oct 2008 19:21:53 -0400 From: John Almberg <jalmberg@identry.com> To: freebsd-questions@freebsd.org Subject: Re: mysql connection through ssl tunnel Message-ID: <33DD5BC0-7D57-4530-BB59-46E2D7A43F1A@identry.com> In-Reply-To: <51D1673D-4689-4F9A-8217-CFC5C58A1145@identry.com> References: <8B945891-5F96-4FBF-8175-15F67F03DD92@identry.com> <48D8F881.1010000@unsane.co.uk> <912A74FB-0292-4A53-B480-34FE69D9C465@identry.com> <20081020212103.GA13334@icarus.home.lan> <007ABF71-6D85-4849-A9E7-933D18236EE8@identry.com> <48FD8876.5090805@infracaninophile.co.uk> <51D1673D-4689-4F9A-8217-CFC5C58A1145@identry.com>
next in thread | previous in thread | raw e-mail | index | archive | help
> Now I just need to figure out how to start it on reboot, but that > is something I've been meaning to learn, anyway, so I don't mind. I hope you guys will bear with me just a little more... I have spent the day trying to figure out how to create an rc script for autossh. Very cool, and not as hard as I'd anticipated. It is attached below. The script works perfectly *iff* I run it from the command line as a non-root user, like so: /usr/local/etc/rc.d/autossh start However, it does NOT work when executed by root. Instead, I get the following error message in /var/log/messages messages:Oct 21 19:01:38 on autossh[89267]: ssh exited prematurely with status 255; autossh exiting So (my understanding), autossh is starting, and tries to create the tunnel, but the tunnel creation fails with the unhelpful 255 error message. But only when executed by root. That's the puzzling part. I don't allow root logins on this server, but don't see how that could cause this problem.... I'm stumped. Any hints, much appreciated. -- John ---------------------- #!/bin/sh # PROVIDE: autossh # REQUIRE: LOGIN # KEYWORD: shutdown . /etc/rc.subr name="autossh" rcvar=`set_rcvar` start_cmd="${name}_start" stop_cmd=":" load_rc_config $name eval "${rcvar}=\${${rcvar}:='NO'}" command="/usr/local/bin/autossh" command_args="-M 20000 -fNg -L 33006:127.0.0.1:3306 admin@example.com" #pidfile="/var/run/autossh.pid" #AUTOSSH_PIDFILE="$pidfile"; export AUTOSSH_PIDFILE autossh_start() { ${command} ${command_args} echo "started autossh" } run_rc_command "$1"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?33DD5BC0-7D57-4530-BB59-46E2D7A43F1A>