Skip to main content

Hide directories/files from clients in FTP

Comments

13 comments

  • cPanelMichael
    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: [QUOTE] # 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:
    0
  • Mark Coates
    Hi yes it would be to hide everything from /home/username onwards except the essentials like public_html, mail and database folders if possible
    0
  • cPanelMichael
    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.
    0
  • Mark Coates
    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
    0
  • cPanelMichael
    Hello Mark, Can you share the output from the following commands on this system? 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.
    0
  • Mark Coates
    Hi @cPanelMichael Here are the results [root@dedivps-75533 ~]# cat /var/cpanel/conf/pureftpd/local cat: /var/cpanel/conf/pureftpd/local: No such file or directory [root@dedivps-75533 ~]# cat /etc/redhat-release CentOS Linux release 7.6.1810 (Core) [root@dedivps-75533 ~]# cat /usr/local/cpanel/version 11.78.0.20 I am using FileZilla on ftp port 21 Thanks
    0
  • cPanelMichael
    [root@dedivps-75533 ~]# 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.
    0
  • Mark Coates
    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
    0
  • cPanelMichael
    Hello @Mark Coates, It looks like you are editing the /var/cpanel/conf/pureftpd/main file. You should instead create the /var/cpanel/conf/pureftpd/local file and add the custom entries to the local file instead of the main file. An example of how to do this is documented at: How to Edit FTP Server Configuration from the Command Line - cPanel Knowledge Base - cPanel Documentation Thank you.
    0
  • Mark Coates
    Hello @Mark Coates, It looks like you are editing the /var/cpanel/conf/pureftpd/main file. You should instead create the /var/cpanel/conf/pureftpd/local file and add the custom entries to the local file instead of the main file. An example of how to do this is documented at:
    0
  • Mark Coates
    Thanks this has now worked. I think it was using the .cache file too. once i removed this it worked instantly.
    0
  • cPanelMichael
    Hi Mark, I'm glad to see it's now working as intended. Thanks for sharing the outcome.
    0
  • Mark Coates
    Hi @cPanelMichael Just a quick one on this. Everything is working well although users are unable to upload . files for example .env and .htaccess for projects like laravel.
    0

Please sign in to leave a comment.