passing options thru '/etc/rc.d/foo start'

Tom Worster fsb at
Wed Sep 16 18:11:17 UTC 2009

On 9/16/09 1:35 PM, "Mel Flynn"
<mel.flynn+fbsd.questions at> wrote:

> On Wednesday 16 September 2009 18:45:29 Tom Worster wrote:
>> is there a general shell syntax that can be used to pass arguments to a
>> daemon that you're starting with the /etc/rc.d/foo start command?
>> for example, how does one start sshd using /etc/rc.d/sshd and pass it
>> '-o X11Forwarding=no' without touching a config file?
> You don't. Defaults are set in /etc/defaults/rc.conf, overridden in
> /etc/rc.conf. Unless you add the logic yourself in /etc/rc.conf, the
> environment is not looked at.
> So this means a one-time edit of /etc/rc.conf:
> if test -n "${SSHD_FLAGS}"; then
> sshd_flags="${SSHD_FLAGS}"
> else
> sshd_flags="${sshd_flags}"
> fi
> Then start with SSHD_FLAGS="-o X11Forwarding=no" /etc/rc.d/sshd start
> But this is specific for sshd, as it supports _flags. There's no generic way
> to do this.

thanks, Mel, that's good to know.

i think your suggestion of modifying rc.conf will turn out to be a tidy
solution for me.


More information about the freebsd-questions mailing list