I'm running WordPress on my VPS with CentOS 7 LAMP stack.I've followed this guide 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:
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
.git
command such as a git pull
requires me to prefix the command with sudo
or else I get a permission error.Any ideas on what I'm missing?
Generally, WordPress directory and folder permissions should be set to 755, and most file permissions need to be set to 644. These are also the file permissions that WordPress recommends you set for your site. These are also the permissions needed for WordPress auto update to function correctly.
Fix File and Folder Permissions in WordPress Using FTPOnce connected go to the root folder of your WordPress site. After that select all folders in root directory and then right click to select 'File Permissions'. This will bring up the file permissions dialog box. Now you need to enter 755 in the numeric value field.
Select File Manager. Right-click on your WordPress folder and select Change Permissions. Enter 755 in the Permission fields. Click Change Permissions to continue.
Type the "CHMOD" command to make the change you need to the file's permission. For example, if you want to make a shell script called "listallfiles" executable, type "chmod +x listallfiles" at the command prompt.
Look at:What does mode_t 0644 mean?
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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With