Permissions for default files/folders on account creation

Hello, we are currently implementing API and we use HestiaCP default folder:

/usr/local/hestia/data/templates/web/skel/public_html/

In this folder we put our content and change permissions like that:

drwxrwxr-x 10 www-data www-data 4096 Oct 25 08:30 public_html

public_html# ls -la
total 52
drwxrwxr-x 10 www-data www-data 4096 Oct 25 08:30 .
drwxr-xr-x  4 root     root     4096 Oct 25 08:30 ..
drwxrwxr-x  8 www-data www-data 4096 Oct 25 08:30 .git
-rw-rw-rw-  1 www-data www-data 2409 Oct 25 08:30 .htaccess
drwxrwxr-x  2 www-data www-data 4096 Oct 25 08:30 admin
drwxrwxr-x  7 www-data www-data 4096 Oct 25 08:30 assets
drwxrwxr-x  4 www-data www-data 4096 Oct 25 08:30 components
drwxrwxr-x  6 www-data www-data 4096 Oct 25 08:30 core
drwxrwxr-x  3 www-data www-data 4096 Oct 25 08:30 editor
-rw-rw-rw-  1 www-data www-data  325 Oct 25 08:30 index.php
drwxrwxr-x  2 www-data www-data 4096 Oct 25 08:30 pages
-rw-rw-rw-  1 www-data www-data   66 Oct 25 08:30 robots.txt
drwxrwxr-x  2 www-data www-data 4096 Oct 25 08:30 static

After we create a new web account we got an Error 500 and not working web account.
Also permissions are denied for index.php and not possible to open.

How can we solve these issues?

Hi,

Show the output of:

ls -lah /home/YOUR_USER/web/NEW_ADDED_DOMAIN/public_html/

Also, check domain logs to view the reason for error 500:

/var/log/apache2/domains/NEW_ADDED_DOMAIN.log
/var/log/apache2/domains/NEW_ADDED_DOMAIN.error.log
1 Like

We should chown the folder user:user

1 Like

did you try to fix the permissions?
find /usr/local/hestia/data/templates/web/skel/public_html/ -type d -exec chmod 755 {} ;
find /usr/local/hestia/data/templates/web/skel/public_html/ -type f -exec chmod 644 {} ;
chown -R www-data:www-data /usr/local/hestia/data/templates/web/skel/public_html/

and restart nginx or apache!

1 Like

Yes but how to chown the folder with newuser:newuser if we chown it already to user www-data:www-data ?

Here is the output for the log file:

# cat /var/log/apache2/domains/myex25.expozy.net.log 
94.237.88.96 - - [25/Oct/2023:09:02:41 +0300] "GET / HTTP/1.0" 200 507 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36"
94.237.88.96 - - [25/Oct/2023:09:02:41 +0300] "GET /favicon.ico HTTP/1.0" 404 200 "http://myex25.expozy.net/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36"
94.237.88.96 - - [25/Oct/2023:09:11:35 +0300] "GET / HTTP/1.0" 200 507 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Safari/605.1.15"
94.237.88.96 - - [25/Oct/2023:09:11:35 +0300] "GET /favicon.ico HTTP/1.0" 404 200 "http://myex25.expozy.net/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Safari/605.1.15"
94.237.88.96 - - [25/Oct/2023:17:21:55 +0300] "GET / HTTP/1.0" 200 507 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Safari/605.1.15"
94.237.88.96 - - [25/Oct/2023:17:21:55 +0300] "GET /favicon.ico HTTP/1.0" 404 200 "http://myex25.expozy.net/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Safari/605.1.15"

Here is the output for the error log file:

[Wed Oct 25 17:21:55.287147 2023] [proxy_fcgi:error] [pid 288944:tid 140218090890816] [client 94.237.88.96:38710] AH01071: Got error 'PHP message: PHP Warning:  require_once(core/autoload.php): Failed to open stream: Permission denied in /home/myex25/web/myex25.expozy.net/public_html/index.php on line 4; PHP message: PHP Fatal error:  Uncaught Error: Failed opening required 'core/autoload.php' (include_path='.:/usr/share/php') in /home/myex25/web/myex25.expozy.net/public_html/index.php:4\nStack trace:\n#0 {main}\n  thrown in /home/myex25/web/myex25.expozy.net/public_html/index.php on line 4'
[Wed Oct 25 17:21:55.384125 2023] [proxy_fcgi:error] [pid 288944:tid 140219040917056] [client 94.237.88.96:38714] AH01071: Got error 'Primary script unknown', referer: http://myex25.expozy.net/

It looks like it doesn’t do the subfolders