News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Can't write to Settings.php

Started by zmmccrocklin, June 04, 2022, 04:20:11 PM

Previous topic - Next topic

zmmccrocklin

Hi guys,
    I'm having an issue here.  I migrated a forum over to another server & am trying to run repair_settings.php , but it seays my Settings.php file is not writeable by my webserver.  I'm trying to figure out why it says that's the case.  Here's the specs:

RockyLinux 8.5
Apache 2.4.37
PHP 8.0.13
SMF 2.1.2

File path permissions on the server:

[root@tbr-fans ~]# namei -l /var/www/thoroughbredracingfans.com/public_html/Settings.php
f: /var/www/thoroughbredracingfans.com/public_html/Settings.php
dr-xr-xr-x root   root   /
drwxr-xr-x root   root   var
drwxr-xr-x root   root   www
drwxr-xr-x root   root   thoroughbredracingfans.com [nofollow]
drwxrwxr-x apache apache public_html
-rw-rw-r-- apache apache Settings.php


Confirmed no facls set:

[root@tbr-fans ~]# getfacl /var/www/thoroughbredracingfans.com/public_html/Settings.php
getfacl: Removing leading '/' from absolute path names
# file: var/www/thoroughbredracingfans.com/public_html/Settings.php
# owner: apache
# group: apache
user::rw-
group::rw-
other::r--


File is not immutable:

[root@tbr-fans ~]# lsattr /var/www/thoroughbredracingfans.com/public_html/Settings.php
-------------------- /var/www/thoroughbredracingfans.com/public_html/Settings.php


I've restarted apache & triple checked all permissions, yet I still get that message at the bottom of the page when running repair_settings.php.


Thanks in advance for your help!


Z

d3vcho

Quote from: zmmccrocklin on June 04, 2022, 04:20:11 PM-rw-rw-r-- apache apache Settings.php

This is 664. You might want to try 666 at least.
"Greeting Death as an old friend, they departed this life as equals"

Arantor

Well, 664 would be fine for either the webserver running as user apache, or with group apache - that begs the question... *is* it running as those?

zmmccrocklin

It doesn't need 666 for Apache to run it (although I did test with 666 & parent directory at 777, still a no go).  RockyLinux was branched off CentOS, which is RHEL, so apache is httpd & the user is apache by default.

I did confirm that httpd.conf shows

User apache
Group apache

Also:

[root@tbr-fans ~]# getent passwd apache; id apache
apache:x:48:48:Apache:/usr/share/httpd:/sbin/nologin
uid=48(apache) gid=48(apache) groups=48(apache)

zmmccrocklin

sheesh...I need to check contexts somewhere.  I though about SELinux, so I tried a restorecon -vR, but it still didn't fix it so I set it to permissive, & sure enough, I can write to the file...once I fix the setttings, I'm gonna set back to enforcing & run a reboot with /.autorelabel & see if it fixes the issue.

EDIT:
The issue is resolved.  I can now edit the file in Enforcing mode after the reboot.

Advertisement: