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

Mel Flynn mel.flynn+fbsd.questions at
Wed Sep 16 17:35:53 UTC 2009

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

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.

More information about the freebsd-questions mailing list