Announcement

#1 2017-09-21 17:53:49

fbadavid
Member
2017-09-21
4

No Write access error starting today, any ideas?

Hello
I installed piwigo in January of 2017 as a way to keep up with all of the photos that our customers send us. It worked great until today. Today I received this message as I tried to connect to my gallery:
Piwigo encountered an irrecoverable error

./_data/templates_c no write access

#1    mkgetdir /var/www/html/gallery/include/template.class.php(116)
#2    Template::__construct /var/www/html/gallery/include/common.inc.php(226)
#3    include_once /var/www/html/gallery/index.php(26)

Where do I begin to try and fix this? I have reset permissions to 777 on everything piwigo related on the server. We only use piwigo on the company intranet. It is installed on CentOS7. I will update this message when I figure out which version of pigwigo I am using along with the php version and MySQL version.

Piwigo version:
PHP version:
MySQL version:
Piwigo URL: http://

Offline

 

#2 2017-09-21 22:47:55

erAck
Only trying to help
2015-09-06
1415

Re: No Write access error starting today, any ideas?

You may have to check ACL (Access Control Lists, sort of extended permissions) on that server, it may have been enabled newly, and/or prevent the web server user from write access (which generally makes sense, but cache and temporary and upload directories need an exception). Setting all permissions to 777 everywhere is dumb anyway.


Running Piwigo at https://erack.net/gallery/

Offline

 

#3 2017-09-22 17:44:46

fbadavid
Member
2017-09-21
4

Re: No Write access error starting today, any ideas?

erAck wrote:

You may have to check ACL (Access Control Lists, sort of extended permissions) on that server, it may have been enabled newly, and/or prevent the web server user from write access (which generally makes sense, but cache and temporary and upload directories need an exception). Setting all permissions to 777 everywhere is dumb anyway.

I checked the ACL for the 3 files listed in the error message. Root has RWX for everything. I am not sure why this problem just started. The 777 permission thing on this server doesn't matter. It is only for in house use. I set it up to make filing our thousands of photos easier to do so we could keep notes with each image. I am the only one who can SSH into this server, the other users only access through their browsers. I am the only one with admin privileges. I am at a loss as to why this issue happened overnight.

Offline

 

#4 2017-09-23 14:23:04

erAck
Only trying to help
2015-09-06
1415

Re: No Write access error starting today, any ideas?

I should not discuss anything further with someone who tries to defend global 777 permissions, but.. have you checked the permissions of the actual directory in the problem, i.e. _data/templates_c
In your screenshot it's only the code files mentioned in the backtrace for which read permissions for the web server user are sufficient.


Running Piwigo at https://erack.net/gallery/

Offline

 

#5 2017-09-25 13:44:17

fbadavid
Member
2017-09-21
4

Re: No Write access error starting today, any ideas?

erAck wrote:

I should not discuss anything further with someone who tries to defend global 777 permissions, but.. have you checked the permissions of the actual directory in the problem, i.e. _data/templates_c
In your screenshot it's only the code files mentioned in the backtrace for which read permissions for the web server user are sufficient.

I am not sure why it matters so much to you that I did a global 777 -R on gallery directory. I did it to try and see if that would fix the no write access. I never said that I was going to leave the permissions this way. I looked at the _data/templates_c and it also has rwx permissions for everyone (temporarily) . Root is the owner and group. I was able to create and save a test.txt file in that directory. I am not sure how to proceed.

Offline

 

#6 2017-09-25 15:07:17

teekay
Member
2013-06-12
427

Re: No Write access error starting today, any ideas?

You said CentOS 7, so could be SElinux-related

What does following command spit out (as root):

Code:

# getenforce

If it says "Enforcing", check the context of /var/www/html/gallery/_data/templates_c

Code:

# ls -Z  /var/www/html/gallery/_data/ | grep templates_c

It should be either "httpd_sys_rw_content_t" or "public_content_rw_t" (the _rw_ matters)

If that's not the case, set it that way:

Code:

chcon -R -t httpd_sys_rw_content_t /var/www/html/gallery/_data

Or, set selinux to permissive.
ad hoc:

Code:

# setenforce 0

and persist this in /etc/sysconfig/selinux

Last edited by teekay (2017-09-25 15:10:02)

Offline

 

#7 2017-09-25 15:24:59

fbadavid
Member
2017-09-21
4

Re: No Write access error starting today, any ideas?

teekay wrote:

You said CentOS 7, so could be SElinux-related

What does following command spit out (as root):

Code:

# getenforce

If it says "Enforcing", check the context of /var/www/html/gallery/_data/templates_c

Code:

# ls -Z  /var/www/html/gallery/_data/ | grep templates_c

It should be either "httpd_sys_rw_content_t" or "public_content_rw_t" (the _rw_ matters)

If that's not the case, set it that way:

Code:

chcon -R -t httpd_sys_rw_content_t /var/www/html/gallery/_data

Or, set selinux to permissive.
ad hoc:

Code:

# setenforce 0

and persist this in /etc/sysconfig/selinux

Thank you for the detailed response here. It was an selinux problem. I have corrected the issue and gallery is working again. I have also removed the 777 permissions and reset them properly. The gallery is still working with the reassigned permissions.

Offline

 

#8 2017-09-27 00:52:11

erAck
Only trying to help
2015-09-06
1415

Re: No Write access error starting today, any ideas?

See also CentOS Troubleshooting SELinux or RHEL SELinux Troubleshooting.

Last edited by erAck (2017-09-27 00:54:57)


Running Piwigo at https://erack.net/gallery/

Offline

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2022 · Contact