how to start one daemon twice from the rc.conf?

Matthew Seaman m.seaman at infracaninophile.co.uk
Tue Jan 8 13:28:49 PST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

ivan dimitrov wrote:

> How to start two sshd with different configs from the rc.conf?
> 
> Do i have to write a secondary /etc/rc.d/sshd, 
> for eg. /etc/rc.d/sshd2 and put sshd2_enable="yes" in the rc.conf
> or there is another way to do this?

No -- that's pretty much the way of it unless the rc file
specifically has support for multiple sessions (eg. /etc/rc.d/jail)

You need to do more than just rename the file though -- you will
need to change the line:

name="sshd"

to read

name="sshd2"

plus you'll need to change the line

command="/usr/sbin/${name}"

to say 

command="/usr/sbin/sshd"

and add

sshd2_enable="YES"
sshd2_flags="-f /etc/ssh/sshd2_config"

to /etc/rc.conf -- assuming you're happy to use the same keys as
for the other sshd instance that's pretty much all that's necessary.

In the general case though you'ld have to do a sweep through the
file and change any variables from sshd_foo to sshd2_foo -- usually
there are a number of references like that, and /etc/rc.d/sshd is
quite unusual in not having them.

	Cheers,

	Matthew

- -- 
Dr Matthew J Seaman MA, D.Phil.                   7 Priory Courtyard
                                                  Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey     Ramsgate
                                                  Kent, CT11 9PW
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHg+VC8Mjk52CukIwRCC7AAJ9Q4ckg6xfyB1Sv2gGqnMpPiAIKIwCdHo4Z
HLoVnrPpraFIDFW8jGA9ilw=
=Hwqd
-----END PGP SIGNATURE-----


More information about the freebsd-questions mailing list