-5

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 ?

Loenix
  • 91
  • Or https://unix.stackexchange.com/questions/12842/make-all-new-files-in-a-directory-accessible-to-a-group/12847#12847 – muru Feb 15 '22 at 10:23
  • @muru So you are considering I should use ACL, I already use it for some other projects but I would like to do that using chmod as, for me, it seems a basic need, isn't it ? – Loenix Feb 15 '22 at 10:28
  • g+s on dir should be enough 2) if files are rwxrwx--- even own by my_user , www-data should be able to edit/delete them ?
  • – Archemar Feb 15 '22 at 10:57
  • Yes but it should do it by default, the group is my_user by default instead of www-data. How to tell system to set new files' default group to another one ? – Loenix Mar 17 '22 at 08:15