From years, I am trying to fake I know how unix permissions works, but In fact, I don't understand anything.
www-data is the apache2 user
My own user is my_user, it's having sudo access
I am using root by using
sudo su -
www-data is having all permissions on
/var/www/html/ (755 www-data:www-data)
I can not connect as www-data and I want to PhpStorm to deploy on this server, using my_user.
So, by default, all folders are r-x, so I allow www-data's group to have full access (As root)
chmod -R g+rwx /var/www/html/project/themes
Then I add my user to this group (As root)
usermod -a -G www-data my_user
Now, logged my_user and phpstorm deployment are still returning "Permission denied". I disconnect my user, reconnect it and now this is working... What's going on dude ? So, I restart PhpStorm and this is working now.
I pushed my new folder on the server and I am now listing files
ls -la /var/www/html/project/themes
drwxrwx--- 2 my_user my_user 4096 Feb 15 09:51 new-folder
Wow buddy, I really need www-data to be able to read it, and edit it, and run it...
I would like the new folders and files are owned by
www-data:www-data to get it work.
But maybe I am wrong ...
So, what is the best and definitive solution about these permissions issues ?