Can I set the default file and folder permissions through C-Panel or WHM?

Outlier

Active Member
Apr 21, 2017
25
1
3
Los Angeles
cPanel Access Level
Root Administrator
On a new server I just bought, it's uploading folders with permissions of 775 and files with permissions of 664. I want folders to have permissions of 755 and files 644. Is there a way to automatically configure that in C-Panel or WHM? It's extremely time consuming to make those permission changes manually for each folder and file. If there is a way to do it, then please let me know. It would be greatly appreciated.
 

kodeslogic

Well-Known Member
Apr 26, 2020
279
95
103
IN
cPanel Access Level
Root Administrator
Can you confirm how the files are uploaded? Some FTP client or cPanel Filemanager?

What are the permissions when you create a test file and folder through the cPanel Filemanager?
 

Outlier

Active Member
Apr 21, 2017
25
1
3
Los Angeles
cPanel Access Level
Root Administrator
When the files are uploaded by my FTP client FileZilla, it gives folders permissions of 775 and files 664. When I tried uploading with CPanel's Filemanager, it does give folders my desired permissions of 755 and files 644. The problem with uploading with CPanel's Filemanager is that you can't seem to upload folders and subfolders, you can only upload files. So you have to manually create a folder, then upload files into it. That's also very time consuming especially if your site has thousands of files and folders.
 

kodeslogic

Well-Known Member
Apr 26, 2020
279
95
103
IN
cPanel Access Level
Root Administrator
  • Like
Reactions: cPRex and Outlier

Outlier

Active Member
Apr 21, 2017
25
1
3
Los Angeles
cPanel Access Level
Root Administrator
You are correct. I used SFTP to connect and I actually suspected that could be the reason because on my previous servers I used FTP to connect and the permissions were correct. So when I tried connecting using FTP, I get the error "ECONNREFUSED - Connection refused by server" and "Cannot establish FTP connection to an SFTP server. Please select proper protocol". When I looked in cPanel, I realized that the FTP icon is missing. Upon further reading, I found out that cPanel has disabled FTP in versions 86 and later. So you have to enable it if you want it. Good to know for next time...
 
Last edited:
  • Like
Reactions: cPRex

kodeslogic

Well-Known Member
Apr 26, 2020
279
95
103
IN
cPanel Access Level
Root Administrator
New installations of cPanel & WHM have ftpd disabled by default.

To enable FTP access from WHM, please follow the below-given steps:

  • Login to WHM interface.
  • Click on icon ‘Service Configuration’.
  • On the next page, click on the icon ‘FTP Server Selection’.
  • You can select Pure-FTPD or Pro-FTPD to enable FTP accounts.
  • Click the ‘Save’ button at the bottom of the page to activate your selection.
  • If you want to edit FTP server configuration to change the settings, navigate to Home »Service Configuration »FTP Server Configuration and modify the settings.
  • Click the ‘Save’ button to change the settings.
 

Outlier

Active Member
Apr 21, 2017
25
1
3
Los Angeles
cPanel Access Level
Root Administrator
New installations of cPanel & WHM have ftpd disabled by default.

To enable FTP access from WHM, please follow the below-given steps:

  • Login to WHM interface.
  • Click on icon ‘Service Configuration’.
  • On the next page, click on the icon ‘FTP Server Selection’.
  • You can select Pure-FTPD or Pro-FTPD to enable FTP accounts.
  • Click the ‘Save’ button at the bottom of the page to activate your selection.
  • If you want to edit FTP server configuration to change the settings, navigate to Home »Service Configuration »FTP Server Configuration and modify the settings.
  • Click the ‘Save’ button to change the settings.
Thanks, I wish I had known this before spending hours upon hours of manually changing each file and folder's permissions. I tested it and uploading via FTP indeed gives the proper permissions of 755 for folders and 644 for files.

While we're discussing permissions, is the proper permission for the public_html folder supposed to be 750?
 

kodeslogic

Well-Known Member
Apr 26, 2020
279
95
103
IN
cPanel Access Level
Root Administrator
Glad to know the file/folder permission issue is now resolved.

While we're discussing permissions, is the proper permission for the public_html folder supposed to be 750?
Yes, 750 is correct permission for the public_html folder.