Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 555 Vote(s) - 3.53 Average
  • 1
  • 2
  • 3
  • 4
  • 5
WordPress file permissions on CentOS7 requiring sudo

#1
I'm running WordPress on my VPS with CentOS 7 LAMP stack.I've followed [this guide][1] to set permissions, i.e. I've run

`sudo chown apache:apache -R *`
to ensure that my wordpress directory is owned by `apache:apache`.

I've also set WordPress directory and file permissions with these commands:

`find . -type d -exec chmod 755 {} \;`

`find . -type f -exec chmod 644 {} \; `

(I had to prefix the above commands with `sudo`)

Normally I manage the server by logging in through SSH using `myuser`, where `myuser` belongs to the `apache` group and the `wheel` group.

I have 3 problems:

1. Any file CRUD command in the WordPress directory still requires me to prefix the command with `sudo`, or else I get a permission error. Since `myuser` belongs to `apache` and `apache` owns the directory, I'm confused as to why I still need to prefix the commands with `sudo`.
2. Similar to problem 1, any `git` command such as a `git pull` requires me to prefix the command with `sudo` or else I get a permission error.
3. When I try to automatically update theme files from my WordPress dashboard web interface, I get permission errors. Interestingly, I'm able to install/update plugins via the WordPress dashboard without any permissions errors.

Any ideas on what I'm missing?

[1]:

[To see links please register here]

Reply

#2
Look at:https://stackoverflow.com/questions/18415904/what-does-mode-t-0644-mean#18415935

644 means:
* (owning) User: read & write
* Group: read
* Other: read
CRUD is a write command, so you're not allowed to do that. Either you change to `664` or keep using sudo. Basically any writing procedure on the file system would not be allowed without sudo since your user is not the owner (event though he is in the group).
Reply

#3
@fortuneRice, CentOS7 features selinux enabled by default, which is often the cause of many hard-to-understand file permission errors.

I would suggest the following:

1. Edit /etc/sysconfig/selinux
2. Change SELINUX=permissive (or whatever SELINUX is currently set to in the file) to **SELINUX=disabled**
3. Reboot your server (not just the apache web server, but the whole machine)

Disabling SELINUX completely is not a good idea, therefore if this procedure works, you should re-enable SELINUX and fix its configuration.

Configuring SELINUX can be a difficult task, so I suggest you read up on google how to do that :)
Reply

#4
chown -R -f user:apache /path of the directory
Reply

#5
I also faced that issue and solved this problem by changing the PHP handler.

**it is important to use PHP Handler that will run as the file owner.**

After I installed HTTP2 and another few features on the way, I changed the PHP handler.

I am running WHM/CPanel on my VPS, and I fixed my issue following these steps:

1. Under `WHM` > `Software` > `EasyApache 4` > `Customize`

Look for the: `mod_suphp` under the `Apache Modules` tab and make sure it is enabled, and if you just turned it on to install, follow step two.
2. Go to the `Review` tab and click the `Provision` button to save.
3. Under `Whm` > `Software` > `MultiPHP Manager` look for `PHP Handlers` tab.
4. Choose `suphp` as the handler for the current PHP version.

That's it. It was the PHP handler.

Edit: I notice that `suphp` had a conflict with one of my user uploads directories that I am adding dynamically to images a watermark. It seems the `suphp` handler had permission to upload but doesn't show the pictures.
I also tried the `lsapi` for the PHP Handler, and it seems to work correctly with the file's permissions and attaching via the .htaccess file watermarks for images.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through