public_html directory not showing in ftp

A user could not show the public_html directory on a cpanel server. Run the following to see how many files are listed in the directory.

cd /home/username
ls|wc -l
10050

This folder has 10500 files. The settings for ftp do not allow a full directory listing. We removed the files that were not needed and ftp worked.

Also this is a setting in /etc/pure-ftpd.conf

nano /etc/pure-ftpd.conf
# 'ls' recursion limits. The first argument is the maximum number of
# files to be displayed. The second one is the max subdirectories depth

LimitRecursion 10000 8

To change this – change the line amount in the first number and restart ftp

LimitRecursion 11000 8
service pure-ftpd restart

To change the ftp maximum number of files on plesk.

nano /etc/proftpd.conf
ListOptions -a maxfiles 2000 maxdepth 3

Restart xinetd

 service xinetd restart

This configures the -a option by default, and limits the maximum files in the generated listing to 2000. If the client uses the -R option, proftpd will not recurse into directories more than 3 levels deep when generating the listing.

Change Ownership of Files and Folders

To change the ownership of files and folders in a directory. For a plesk httpdocs directory that runs fastcgi. For apache – you will want to change this to apache:apache.

Change directory

cd /var/www/vhosts/domain.com/httpdocs

Find who owns the files and folders.


ls -la
[root@austin httpdocs]# ls -la
total 20
drwxr-xr-x  3 mungoadmin psacln 4096 Jun 11 14:16 .
drwxr-xr-x 22 mungoadmin psacln 4096 Jun 11 14:13 ..
drwxr-xr-x  2 root       root   4096 Jun 11 14:16 anotherdir
-rw-r--r--  1 root       root      6 Jun 11 14:14 test1.txt
-rw-r--r--  1 root       root     10 Jun 11 14:15 test2.php

You see that some files/directories are owned by root:root an some by mungoadmin:psacln. We will want to change this to be the ftp user in plesk – which is mungoadmin:psacln.

To change this run the following (Warning – make sure you are in the directory you want to change all the files/directories in):

[root@austin httpdocs]# chown -R mungoadmin:psacln *

Now – look at the changes

[root@austin test]# ls -la
total 20
drwxr-xr-x  3 mungoadmin psacln 4096 Jun 11 14:16 .
drwxr-xr-x 22 mungoadmin psacln 4096 Jun 11 14:13 ..
drwxr-xr-x  2 mungoadmin psacln 4096 Jun 11 14:17 anotherdir
-rw-r--r--  1 mungoadmin psacln    6 Jun 11 14:14 test1.txt
-rw-r--r--  1 mungoadmin psacln   10 Jun 11 14:15 test2.php