Home / Linux / How to Change Recursion Limit (File Limit List) in PureFTPd on cPanel

How to Change Recursion Limit (File Limit List) in PureFTPd on cPanel

By default, PureFTP server on cPanel has a limit on a number of files displayed through an ftp client. It is usualy 10000, if you need more files displayed follow this quick tutorial.

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 10000 to 30000, which will allow the FTP server to display more than 10000 files in a single folder. To do this, I’ll edit the value in the template file:

pico -w /var/cpanel/conf/pureftpd/main

Search or scroll till you see “LimitRecursion”

LimitRecursion 10000 8

10000 represents the number of files displayed and 8 number of subdirectories.
Change it to whatever you want for example:

LimitRecursion 30000 15

Save the file after modification, and then apply the changes using one of the WHM binaries invoked from command line:

/usr/local/cpanel/whostmgr/bin/whostmgr2 doftpconfiguration

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
/usr/local/cpanel/whostmgr/bin/whostmgr2 doftpconfiguration

Now you can upload and view total 30000 files through ftp and 15 parallel subdirectories are allowed.

About saLam