Setting up user and group permissions
Setting up permissions for Laravel project (solves issue with log being created by www-data for web or root for CLI) -- via: https://askubuntu.com/a/365108
If we check ownership of site1, we will find something like this,
This means that the directory is owned by user root, group root. While user root has write permission (plus read and execute permissions) to the directory, group root has only read and execute permissions.
We will want to change the group ownership to another (new) group and add user1 to that particular group. We will give write permission to that particular group as well.
Create a new group,
Add user1 to the newly created group,
Check that user1 is really in that group,
The output should be a list something like,
Now we can change the group ownership of your intended directory.
Grant write permission to this new group owner,
Check that all the changes are indeed there,
So, the directory now is owned by user root, group laravel-app. Both user root and group laravel have write permission (plus read and execute permissions) to the directory. Any user belonging to group laravel will enjoy all the privileges granted to that group.