What permissions to use in a web server for wordpress?

0

I have a subdomain for different projects in the path / var / www / subdomain / public_html

sub.dominio.com/proyectoA
sub.dominio.com/proyectoB
sub.dominio.com/proyectoC

I have two users on the server (root and userA), in order to upload and edit the template files I use the userA through SFTP. Assuming I have to create a new project, I have to connect by ssh

$ cd /var/www/subdominio/public_html
$ mkdir proyectoD
$ cp -r wordpress/* proyectoD/

For the wordpress to install plugins I have to run

# chown -R www-data:www-data proyectoD

But to be able to edit the files of the theme I have to execute

# chown -R usuarioA:www-data proyectoD/wp-content/themes

Is there a way that you do not have to change the owner of the directory every time you create a new project? You just have to create the folder and copy the contents of the wordpress.tar.gz in the new directory.

    
asked by akko 01.12.2017 в 20:49
source

1 answer

0

Copy it with the user ' root ':

$sudo cp -a  wordpress/* proyectoD/

The -a parameter works like:

-a = -dR and --preserve = all

That is to say Recursive, Preserving files of type link and in addition it conserves the permissions and owner of the files.

You can save yourself even creating the directory (mkdir) and setting the permissions of the directory you created ...

$ sudo cp -a wordpress NuevoProyecto
    
answered by 04.12.2017 в 14:20