It’s my first time trying to set up WordPress or any website on a cloud hosting. I am on Ubuntu server, and WordPress is located in var/www/mydomain/public folder.
What I want to achieve is this: Both WordPress (PHP) and SFTP users can access and modify the same files. And WordPress should be able to do it’s automatic update for plugins, etc.
This is what I have done so far:
- I have chmodded this folder to 775 to allow group read/write permissions.
- I have added apache user (www-data) and SFTP user (suser) both to group wp.
- I have made wp as the group owner of all files inside the wordpress folder.
What works:
- I can edit theme and plugin files with WordPress’s built-in theme/plugin editor.
What does not work:
- WordPress update still asks for the FTP details to carry out the update
- When I create a new file with SFTP user, it’s permissions will be 644, but they should be 775
What I’ve tried
- I have tried all the steps here (answer by caf): A general linux file permissions question: Apache and WordPress
- I have tried this: http://jeff.robbins.ws/articles/setting-the-umask-for-sftp-transactions
- I have also tried adding umask 002 to my SFTP startup login files, but I do not know where they are located.
As far as I understand, the problem lies somewhere with the permissions/umask thing. I know very little about linux so this may be a stupid question with a simple solution, but I have no idea how to fix it.
UPDATE: I did not know that I would have to restart the ssh server. I did it with this command /etc/init.d/ssh restart
and after that files created with SFTP have permissions 664 (as they are supposed to)
Also, it seems that Apache has to be restarted as well, with this command: /etc/init.d/apache2 restart
However, WordPress still won’t do automatic update (asks for FTP credentials)
If you’re able to install the SSH2 PHP Module WordPress will then give you the option to upgrade over SFTP.
In Ubuntu:
In CentOS (EPEL required):
I was trying to do the same thing with WordPress updates, until I realized that WordPress only supports FTP which, confusingly, SFTP is not. From Wikipedia:
I’m still trying to figure out if there’s a secure way to do WordPress updates automatically; I don’t know yet whether or not FTPS is truly secure.