SOLVED Hide directories/files from clients in FTP

Mark Coates

Well-Known Member
Mar 13, 2019
96
12
8
Doncaster
cPanel Access Level
Root Administrator
Hi i have had a look on here and cant find exactly what i require.

I would like to hide folders from the client when they access via FTP although keeping the folders still their for the system if possible or an alternative.

I would like their ftp to look like image "mini ftp" as at the minute it looks like "current ftp" as the average use does not require these additional folder access. Ideally access to
  • mail
  • public_ftp
  • public_html
  • sub domains & domains should they be created in the root
Any help would be awesome!

Cheers
 

Attachments

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,911
2,234
363
Hello @Mark Coates,

Can you confirm if you're attempting to restrict access to the directories starting with a period (e.g. .cpanel), or are you looking to simply hide them when someone connects to the account via FTP?

If you just want to adjust the FTP behavior, you can modify the following Pure-FTPd configuration settings:

# List dot-files even when the client doesn't send "-a".
DisplayDotFiles yes

# Users can't delete/write files beginning with a dot ('.')
# even if they own them. If TrustedGID is enabled, this group
# will have access to dot-files, though.
ProhibitDotFilesWrite no

# Prohibit *reading* of files beginning with a dot (.history, .ssh...)
ProhibitDotFilesRead no
An example of how to modify the Pure-FTPd configuration values is available on the document below:

How to Enable FTP Passive Mode - cPanel Knowledge Base - cPanel Documentation

Thank you.
 
  • Like
Reactions: Mark Coates

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,911
2,234
363
Hi yes it would be to hide everything from /home/username onwards except the essentials like public_html, mail and database folders if possible
You can change ProhibitDotFilesRead to yes in the Pure-FTPd configuration file (see my previous post for instructions) to hide directories starting with a period, but keep in-mind this is limited to the FTP service. The directories will remain visible when a cPanel user accesses the account over a service such as SSH or through File Manager.

Let me know if you have any questions.

Thank you.
 
  • Like
Reactions: Mark Coates

Mark Coates

Well-Known Member
Mar 13, 2019
96
12
8
Doncaster
cPanel Access Level
Root Administrator
hi @cPanelMichael

Im not sure if it is linked but i have noticed since i have done this, which is great by the way, the users of FTP can now go right back to the vps root. Although they cannot change or see 99% of the files they can still see the directory structure.

I have attached images to show this.

Thanks
 

Attachments

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,911
2,234
363
Hello Mark,

Can you share the output from the following commands on this system?

Code:
cat /var/cpanel/conf/pureftpd/local
cat /etc/redhat-release
cat /usr/local/cpanel/version
Also, to confirm, is the FTP client you are using in the example connecting over the FTP protocol and not the SFTP protocol?

Thank you.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,911
2,234
363
[[email protected] ~]# cat /var/cpanel/conf/pureftpd/local
cat: /var/cpanel/conf/pureftpd/local: No such file or directory
This is the file you must edit to ensure the custom Pure-FTPd configuration settings are preserved. Did you remove this file after testing, or use another method to enable the custom Pure-FTPd settings?

Thank you.
 

Mark Coates

Well-Known Member
Mar 13, 2019
96
12
8
Doncaster
cPanel Access Level
Root Administrator
hi @cPanelMichael

No the file is there the one i have been editing. please see attached.

The 3 images include what is in my configuration file, the location of that file and the sample directory is a complete seperate account using ftp showing that its not being applied.

after the file has been uploaded i have then used this line in the terminal to reboot the ftp

/usr/local/cpanel/scripts/setupftpserver pure-ftpd --force
 

Attachments

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,911
2,234
363

Mark Coates

Well-Known Member
Mar 13, 2019
96
12
8
Doncaster
cPanel Access Level
Root Administrator

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,911
2,234
363
Hi Mark,

I'm glad to see it's now working as intended. Thanks for sharing the outcome.