# New to FreeBSD - inetd or rc.conf ?



## mikey777 (May 23, 2020)

I'm fairly new to FreeBSD, and unix in general as I used to always be the overseer of unix groups...
Why do we still have inetd ?
Or, why are we moving towards rc.conf ?
Do we need both ?


----------



## Hakaba (May 23, 2020)

maybe it is not in the scope of your question, but I read this some day ago about `sinit` and `Deamontools`.
it is not FreeBSD related, but it explain the spirit behind.


----------



## jmos (May 23, 2020)

rc.conf: system configuration
inetd: specialised starter for internet tools

There is no "switching from inetd to rc.conf", both are really different tools: Inetd fires up a service only when it is requested to be run, while services started via rc.conf are up right after the system boot. And rc.conf isn‘t only a starter for services: hostname, keymap, network configuration stuff etc. is configured there. Internet services started via rc.conf are daemons, they are running all the time. Services started via inetd are stopped after the job is done.

So: Yes, we need rc.conf. If you need inetd depends on your use case.


----------



## mikey777 (May 23, 2020)

Oh. I was under the assumption that if sshd, ftpd, ? are started in inetd they are always available. Maybe what I was reading is that as long as inted has started, it can spawn sshd/ftpd/? whenever it needs to. So is is better for a process like sshd to run as it's own process or have a parent like inetd ?
BTW, why does sshd and ftpd have hard-coded process IDs ?


----------



## zirias@ (May 23, 2020)

mikey777 said:


> why does sshd and ftpd have hard-coded process IDs ?


Could you please consider using a different OS?


----------



## DonK (May 24, 2020)

mikey777 said:


> I was under the assumption that if sshd, ftpd, ? are started in inetd they are always available. Maybe what I was reading is that as long as inted has started, it can spawn sshd/ftpd/? whenever it needs to. So is is better for a process like sshd to run as it's own process or have a parent like inetd ?



It works best for me to add sshd_enable="YES" to /etc/rc.conf and to use inetd for  ftpd, popd, and tftpd.


----------



## jmos (May 24, 2020)

mikey777 said:


> I was under the assumption that if sshd, ftpd, ? are started in inetd they are always available. Maybe what I was reading is that as long as inted has started, it can spawn sshd/ftpd/? whenever it needs to. So is is better for a process like sshd to run as it's own process or have a parent like inetd ?



Depends all on your configuration of inetd an the corresponding executables. The intention of inetd is not to have services running all the time when they are not needed all the time. But you can be creative in starting and stopping daemons (even out of a start menu in a X11 session).

To cut a long story short: Don't think about inetd as long as you don't have a use case where the usual way makes you some headaches. Nowadays inetd is rather seldom used, and mostly for services where inetd makes sense the author of such a tool writes about it in the documentation. And in case of SSHD the FreeBSD handbook describes no inetd. But of course: You can do that. But as long as you don't know why: No need for it.



mikey777 said:


> BTW, why does sshd and ftpd have hard-coded process IDs ?



If your executing a "service sshd restart" you'll see that sshd doesn't have a hard coded process ID - it changes. I strongly expect ftpd to do the same.


----------



## gnath (May 24, 2020)

mikey777 said:


> Do we need both ?


Not really, you have required services which FreeBSD provides with full control and designed in that way. Inetd is a super-server daemon on Linux systems with many security issues and designed in that way for that system.


----------

