FreeBSD's FTP Server Doesn't Honor Configuration Values in ftpd.conf

While trying to setup an FTP server on my FreeBSD 7.2 system, for some reason anything I put into the /etc/ftpd.conf file did not work. I wanted to specify a PASSIVE ports range and according to the FreeBSD documentation, the following line in the ftpd.conf file *should* do it.


portrange all 52100 52121

The above is suppose to tell the built in FreeBSD FTP server (/usr/libexec/ftpd) to use ports 52100 thru 52121 as the passive ports range. For some reason it does not. I tried other settings, such as setting up a chroot user. Still nothing. It's as if ftpd isn't even seeing the file. Also, according to the documentation a sample file should be found at /usr/share/examples/ftp/ftpd.conf. Unfortunately, it's not their and missing for some reason.

After several hours, and many search queries on Google. I came across a post on the FreeBSD forums about another user who was trying to setup chrooted users, and having the same issues. It turns out that /usr/libexec/ftpd indeed does not use the /etc/ftpd.conf file, the documentation is incorrect (or outdated).

The /etc/ftpd.conf file is used for another server, and fortunately it's also included in the FreeBSD base system: /usr/libexec/lukemftpd.

So, after learning this I changed my /etc/inetd.conf file to use /usr/libexec/lukemftpd instead of /usr/libexec/ftpd. It's as easy as just commenting out the ftpd entry and un-commenting the lukemftpd entry a few lines down.


#ftp stream tcp nowait root /usr/libexec/ftpd ftpd -l
#ftp stream tcp6 nowait root /usr/libexec/ftpd ftpd -l
ftp stream tcp nowait root /usr/libexec/lukemftpd ftpd -l -r
#ftp stream tcp6 nowait root /usr/libexec/lukemftpd ftpd -l -r

Then I refreshed the configuration with:


/etc/rc.d/inetd restart

Or, if you were using ftpd_enable="YES" in your rc.conf file, stop the server manually, and remove it from their. Then put in inetd_enable="YES" instead (if it isn't already thier) and run the above command.

The end result should be what you were looking for. The ftp server will read the configuration from the ftpd.conf file.