Linux – How to give two user permission in same directory (linux)

linuxusers

I need to give permission for two users in the same directory, ie

I'm running a web application in /var/www and I want to make web server(nginx) writable, also want to give access to a ftp user(/var/www is the home directory of ftp user). I have tried with setfacl but that doesn't work?

Best Answer

  1. (optionally) create a group groupadd groupname
  2. add both users to the group for u in user1 user2 ; do usermod -aG groupname $u ; done
  3. set the group as the owner of the directory (and files inside) chown :groupname /var/www ; chmod -R g+rwX /var/www
Related Question