The PureFTP daemon is easy to configure on a cPanel server using WHM or the PureFTPd configuration file. 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 PureFTPd configuration 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, (Main > Service Configuration > FTP Server Configuration) 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 PureFTP configuration. I’m going to change the MaxClientsPerIP value from 8 to 16, which will allow the FTP server to accept up to 16 simultanious connection from a single IP . 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:
If we need to specify an option that isn’t in the template, we can do this in 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. Along with that, you must be aware of the configuration directives, if they are wrong, FTP server wont start.
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 come 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/ftpconfig
By using this you can deploy your standard configuration for FTP in cPanel server within minutes, without even logging in to the WHM of the server. This will save a lot of time when you are deploying servers on a daily basis, or you can even script this to happen and redeploy the changes easily.