Wednesday, October 16, 2019

Drupal 7 / Ubercart 7 - Enabling Drupal GUI to upload modules - File Permissions Solved & Explained

While attempting to use the internal feature of Drupal 7 to upload and install modules from within the interface:



I encountered the following error:



Nothing was listed under next steps?  How very helpful.....!

So I did the research and resolved the issue.  Here's what I did to resolve that error, with the minimum disruption to my SELINUX security model:

Provisos:

No "777" permissisons
No "-R" blanket ownership changes

First, establish who owns the apache web server (what user/group), because that is the user that is being blocked somehow:

#egrep -i '^user|^group' /etc/httpd/conf/httpd.conf
User apache
Group apache

Next, investigate the original state of the website from a permissions perspective:

Regular File Permissions

# ls -l
total 4
drwxr-xr-x.  4 holisticpethelp.com holisticpethelp.com   67 Dec 26  2018 libraries
drwxr-xr-x. 43 holisticpethelp.com holisticpethelp.com 4096 Oct 16 13:31 modules
drwxr-xr-x.  3 holisticpethelp.com holisticpethelp.com   23 Mar  6  2018 themes

SELINUX File Permissions:

# ls -lZ
drwxr-xr-x. holisticpethelp.com holisticpethelp.com unconfined_u:object_r:httpd_sys_content_t:s0 libraries
drwxr-xr-x. holisticpethelp.com holisticpethelp.com unconfined_u:object_r:httpd_sys_content_t:s0 modules
drwxr-xr-x. holisticpethelp.com holisticpethelp.com unconfined_u:object_r:httpd_sys_content_t:s0 themes

Now we have an idea of what to do:
  • apache is the user we need to enable
  • modules is the area of the file system we need to alter

Resolution:

1)  Make the modules directory the property of apache
2)  Make the modules directory write-able by apache

Commands:

The following commands enable the user apache to install new modules in the modules directory of Drupal 7 via its web interface:

#chown apache:apache modules
#chcon -t httpd_sys_rw_content_t modules

Here's what happened after I made these changes:



References:


No comments:

Post a Comment