Apache and sftp permissions to automatically update Wordpress in ubuntu

This is my first time trying to set up Wordpress or any site on a cloud hosting. I am on a Ubuntu server, and Wordpress is in the var / www / mydomain / public folder.

I want to achieve this:. Wordpress (PHP) and SFTP users can receive and modify the same files. And Wordpress should be able to do this 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 added the apache user (www-data) and the SFTP user (suser) to group wp.
  • I made wp as the owner of the group of all the files inside the wordpress folder.

What works:

  • I can edit themes and plugin files using the built-in Word / Wordpress editor.

What does not work:

  • Wordpress Update still requests FTP data for update
  • When I create a new file with an SFTP user, its permissions will be 644, but they should be 775

What i tried

As far as I understand, the problem lies somewhere with / umask permissions. I know very little about Linux, so this might be a dumb 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 this using this command /etc/init.d/ssh restart , and after that the files created using SFTP have 664 permissions (as expected). Also, it seems that Apache also needs to be restarted with this command : /etc/init.d/apache2 restart

However, Wordpress will still not automatically update (it asks for FTP credentials)

+4
source share
2 answers

If you can install the SSH2 PHP module, Wordpress will give you the option to upgrade SFTP.

In Ubuntu:

 sudo apt-get install libssh2-php 

On CentOS (EPEL required):

 sudo yum install php-pecl-ssh2 
+2
source

I tried to do the same with Wordpress updates until I realized that Wordpress only supports FTP, which, vaguely, SFTP is not. From Wikipedia :

FTPS should not be confused with the SSH file transfer protocol (SFTP), an incompatible file transfer subsystem for Secure Shell (SSH). It also differs from Secure FTP, the practice of tunneling FTP over an SSH connection.

I'm still trying to figure out if there is a safe way to do Wordpress updates automatically; I don't know yet if FTPS is really safe.

0
source

Source: https://habr.com/ru/post/1382556/


All Articles