Trying to install a plugin in a new moodle installation.

Trying to install a plugin in a new moodle installation.

Igor BastosMartins發表於
Number of replies: 4

Hello guys, I just finish to install a new moodle in a Ubuntu 22.04 with with PHP Version 7.4.30 + Apache2 + 8.0.30. To do that I followed this link https://docs.moodle.org/400/en/Step-by-step_Installation_Guide_for_Ubuntu

The moodle is running, and then I tryed to customized it. The first action that I did was tried to install a new template with a plugin in Site Administration; Plugins; Install plugins; so I drag and drop my zip file. When I did that I received the bellow message:

Validating theme_klass ... Error

  [Error] Write access check [/var/www/html/moodle/theme]

Installation aborted due to validation failure

 

Of course, that I understand that my problem is related to the access permission in that directory. So, In the console o executed the bellow command to check the owner and permissions:

# cd /var/www/html/moodle;

# ls -l

drwxr-xr-x 14 root root   4096 Sep 23 17:18 admin

drwxr-xr-x  5 root root   4096 Sep 23 17:18 analytics

drwxr-xr-x 17 root root   4096 Sep 23 17:18 auth

drwxr-xr-x  8 root root   4096 Sep 23 17:18 availability

drwxr-xr-x  8 root root   4096 Sep 23 17:18 backup

drwxr-xr-x  8 root root   4096 Sep 23 17:18 badges

-rwxr-xr-x  1 root root    302 Sep 23 17:19 behat.yml.dist

drwxr-xr-x 48 root root   4096 Sep 23 17:19 blocks

drwxr-xr-x  4 root root   4096 Sep 23 17:19 blog

-rwxr-xr-x  1 root root   1162 Sep 23 17:19 brokenfile.php

drwxr-xr-x  7 root root   4096 Sep 23 17:19 cache

drwxr-xr-x  7 root root   4096 Sep 23 17:18 calendar

drwxr-xr-x  4 root root   4096 Sep 23 17:18 cohort

drwxr-xr-x  4 root root   4096 Sep 23 17:18 comment

drwxr-xr-x  4 root root   4096 Sep 23 17:18 competency

drwxr-xr-x  5 root root   4096 Sep 23 17:18 completion

-rwxr-xr-x  1 root root   2247 Sep 23 17:19 composer.json

-rwxr-xr-x  1 root root 186392 Sep 23 17:19 composer.lock

-rwxr-xr-x  1 root root  60954 Sep 23 17:19 config-dist.php

-rwxr-xr-x  1 root root    731 Sep 25 23:06 config.php

All folders and files belongs to root:root and the permission are rwxr-xr-x. What should I do to be able to install a new plugin with web administration?

Thanks, Igor Martins

評比平均分數: -
In reply to Igor BastosMartins

Re: Trying to install a plugin in a new moodle installation.

AL Rachels發表於
Core developers的相片 Particularly helpful Moodlers的相片 Plugin developers的相片 Testers的相片
Since you are trying to install a theme, the moodle/theme folder needs permission for www-data instead of root. Same thing if you later decide to install other plugins. Depending on the type of plugin, and its correct moodle folder, such as moodle/block for blocks or moodle/mod for modules, etc., www-data needs the permission and not root.
In reply to AL Rachels

Re: Trying to install a plugin in a new moodle installation.

Igor BastosMartins發表於
Hi AL Rachels, I was thinking about you wrote, and them I change the owner from the main folder /var/www/html/moodle/ and after that I was ablel to install a new plugin. My new question is if should i change the group owner to. Because now the owner is www-data and the group is root.

Thanks.
In reply to Igor BastosMartins

Re: Trying to install a plugin in a new moodle installation.

Visvanath Ratnaweera發表於
Particularly helpful Moodlers的相片 Translators的相片
Hi

The only hard rule is that the web sever must have read permissions on everything in Moodle code tree. For me, it is common sense that web server should not have write permissions anywhere in the Moodle code tree. But people are divided on this, some allow write permissions exactly for the reason you had. Others open write permissions temporarily and close once the additional plug-in is installed. Others don't depend on the GUI based plug-in installation at all, they download the plug-in code through system access instead, like first downloading the zip archive and unzipping it or using Git.

The basic Unix file permissions allow many combinations for this. I've posted my common formula here https://moodle.org/mod/forum/discuss.php?d=438257#p1764359. It is explained taking Moodle core as example but valid for additional plug-ins as well.