D
D
Dmitry Sokolov2021-01-10 17:37:28
linux
Dmitry Sokolov, 2021-01-10 17:37:28

What permissions should be given to the Apache www-data user?

Hello!

I am developing a small web application.

When registering, the /users/"user->id"/ folder is immediately registered for the user. I
create a folder using php mkdir, but it is not created.
In the future, files will be uploaded to this folder by the parser, which is written in python and is executed using shell_exec("parser launch command");

I understand that the www-data user does not have enough rights, but I don’t know what rights to give so that I can perform these actions and everything is safe.

Ubuntu 18.04 Apache.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Victor Taran, 2021-01-11
@flager

chown -R www-data:www-data /var/www/site.ru
but it's best to do the following option
to run Apache for each site under your users
, it all depends on the PHP presentation mode

V
vreitech, 2021-01-10
@fzfx

chown www-data /users
chmod u+rwx /users

these rights should be enough to create folders and files inside /users, if, of course, php is really running on behalf of the www-data user.

S
Sanes, 2021-01-10
@Sanes

To be safe, scripts must be run as a separate user.
Without any www-data
Look for how to configure one of the options

  • Apache mpm-itk
  • Apache mod_ruid2
  • PHP Fast CGI
  • php-fpm

I would choose PHP-FPM

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question