mysql connection through ssl tunnel
John Almberg
jalmberg at identry.com
Wed Oct 22 09:58:48 PDT 2008
>> Answering my own question (probably the best way)...
>> I solved this problem by figuring out how to execute the command
>> inside the rc script as a non-root user. Like so:
>> autossh_start()
>> {
>> echo "${command} ${command_args}"
>> su admin -c "${command} ${command_args}"
>> echo "started autossh"
>> }
>> This works beautifully, so I almost hesitate to ask, but is there
>> anything wrong with this approach?
>
> Nothing, except you're re-inventing the wheel. rc.subr already
> has a mechanism for running commands as another user. Instead
> of defining a new start() function, simply add something like:
>
> : ${autossh_user:='admin'}
>
> towards the top of the script. (This also means you can override
> the setting by defining 'autossh_user="someoneelse"' in /etc/rc.conf
> in the usual way)
>
Ah, fascinating. Now that I know what I'm looking for, I can see that
in the rc.subr man page.
Thanks!
More information about the freebsd-questions
mailing list