Ftp is easy to configure on a cPanel server using WHM or the pureFTP configuration file. The FTP service configuration in WHM is a no-brainer, but for those looking to set up FTP from command line (such as for automation purposes), you can use cPanel’s built-in template system to apply configuration options that will not be overwritten during cPanel updates.
The pureFTP template is located in /var/cpanel/conf/pureftpd/main, and is set up YAML style similar to most of cPanel’s internal configuration files. The settings in the template correlate directly to the same options in /etc/pure-ftpd.conf, but it’s better to edit the template since cPanel tends to prefer template-based configuration to regenerate (overwrite) config files.
So let’s change an option in the FTP configuration. I’m going to change the LimitRecursion value from 2000 to 10000, which will allow the FTP server to display more than 2000 files in a single folder. To do this, I’ll edit the value in the template file mentioned previously, and then apply the changes using one of the WHM binaries invoked from command line:
What if I wanted to specify an option that isn’t in the template? Well, you can do this one of two ways:
1. Add the option to the template
If you do this, note the syntax in the other FTP options – yes and no are enclosed in single quotes, everything else is not. You also need to envoke doftpconfiguration via the whostmgr2 command as shown above.
2. Change the option to pure-ftp.conf
You can change an option in the FTP configuration file and run /scripts/ftpup –force, and the template will add the changed values to the template as long as they don’t already exist. If they do, the template will change the specified option in pure-ftpd.conf to match its own value.
Generally this would com in use if you’re automating server setups. You can create a standard template for pureFTP, and download it to your server upon setup and update the configuration. This prevents you from having to modify anything manually, which can be a pain when deploying a large number of servers:
wget -O /var/cpanel/conf/pureftp/main http://yourrepo/pureftp/main