Permision for new folder in /web/domain

Hello. When I try to install Moodle I need to create directory (moodledata for example) which “should be both readable and writeable by the web server user (usually ‘www-data’, ‘nobody’, or ‘apache’). It must not be directly accessible over the web”. How I can do that?

If you unzip the image of a fresh install your folders should be created.

You can also use the file manager to create the folder. The permissions should work out of the box.

I am not 100% sure but I think you don’t have to grant extra permissions for www-data.

Folders should have 750 or 755 and files 660 or 666.

The ownership should be user:user

I’m sory, but it is not work. May be is Ubuntu security? I have error “Parent directory (/home/test/web/md.msosh1.ru) is not writeable. Data directory (/home/test/web/md.msosh1.ru/moodledata) cannot be created by the installer.” And when I create this folder via ftp or web fle manager it did not work too.

Log in via ssh
mkdir foldername
chown -R username:username foldername
chmod 750 foldername

What is you setup apache2 + modphp or php-fpm or nginx + php-fpm?

My log
admin@hestiacp:~$ sudo su
[sudo] password for admin:
root@hestiacp:/home/admin# mkdir /home/test/web/md.msosh1.ru/moodledata
root@hestiacp:/home/admin# chown -R test:test /home/test/web/md.msosh1.ru/moodledata
root@hestiacp:/home/admin# chmod 750 /home/test/web/md.msosh1.ru/moodledata

What I doing wrong?

Setup is standart. Nginx+apache

Not sure (I never installed Moodle) but from their docs here

Moodle site moodle directory - MoodleDocs.

it seems folder should be created during the install process. Hence you should not create it manually.

So try to see if your web installation process has errors.

Unfortunately it is not certainly in that way. Because if I select public_shtml folder everything is good.

public_shtml is not supported anymore from Hestia since 1.4.0.

And I don’t understand what you mean honestly :slight_smile:

Ok. In version 1.4.2 work with /private folder instead moodledata) But is not rigth)

Check your logs on installation process (web access and error logs) to see what is the problem on your setup.

If you believe your setup is perfect (on server + Hestia) and no errors from logs above, I would check on Moodle community.

Log is clear.
Error:
[Tue Jun 08 09:00:48.467398 2021] [proxy_fcgi:error] [pid 32666:tid 140488942233344] [client 192.168.10.90:0] AH01071: Got error ‘PHP message: PHP Warning: file_exists(): open_basedir restriction in effect. File(/home/test/web/md.msosh1.ru/moodledata) is not within the allowed path(s): (/home/test/web/md.msosh1.ru/public_html:/home/test/web/md.msosh1.ru/public_shtml:/home/test/tmp:/var/www/html:/etc/phpmyadmin:/var/lib/phpmyadmin:/etc/phppgadmin:/etc/roundcube:/var/lib/roundcube:/tmp:/bin:/usr/bin:/usr/local/bin:/usr/share:/opt) in /home/test/web/md.msosh1.ru/public_html/install.php on line 329PHP message: PHP Warning: is_writable(): open_basedir restriction in effect. File(/home/test/web/md.msosh1.ru) is not within the allowed path(s): (/home/test/web/md.msosh1.ru/public_html:/home/test/web/md.msosh1.ru/public_shtml:/home/test/tmp:/var/www/html:/etc/phpmyadmin:/var/lib/phpmyadmin:/etc/phppgadmin:/etc/roundcube:/var/lib/roundcube:/tmp:/bin:/usr/bin:/usr/local/bin:/usr/share:/opt) in /home/test/web/md.msosh1.ru/public_html/install.php on line 333’, referer: http://md.msosh1.ru/install.php

Very clear indeed

PHP Warning: file_exists(): open_basedir restriction in effect. File(/home/test/web/md.msosh1.ru/moodledata) is not within the allowed path(s):

This is your problem. Check your php template and set the proper openbasedir path. To make it, please create a new template for your moodle app because if you edit the default one it will be overwritten at the next hestia update.

1 Like

and i just notice you should place all the files inside /home/test/web/md.msosh1.ru/public_html/ folder.

*a tip here, never share your public urls or IPs.

1 Like

Access Log is clear I meant)
Can I create a new template via Web interface?

Moodledata should be separate or moodle say “Dataroot location is not secure”

Ok, Thanks.

no, you just have to check around. You may want start from Getting Started | Hestia Control Panel