My own experience in this area here. Tested on Ubuntu 18.04.
Allow to write in the system folder
Give write permission to /etc/nginx/
folder.
# Check 'webmasters' group doen't exist
cat /etc/group | grep webmasters
# Create 'webmasters' group
sudo addgroup webmasters
# Add users to 'webmasters' group
sudo usermod -a -G webmasters username
sudo usermod -a -G webmasters vozman
sudo usermod -a -G webmasters romanroskach
Group assignment changes won't take effect
until the users log out and back in.
Create directory
sudo mkdir /etc/nginx/
Check directory permissions
ls -al /etc | grep nginx
drwxr-xr-x 2 root root 4096 Dec 5 18:30 nginx
Change group owner of the directory
sudo chgrp -R webmasters /etc/nginx/
Check that the group owner is changed
ls -al /etc | grep nginx
drwxr-xr-x 2 root webmasters 4096 Dec 5 18:30 nginx
Give write permission to the group
sudo chmod -R g+w /etc/nginx/
Check
ls -al /etc | grep nginx
drwxrwxr-x 2 root webmasters 4096 Dec 5 18:30 nginx
Try to create file
sudo -u username touch /etc/nginx/test.txt # should work
sudo -u username touch /etc/test.txt # Permission denied
Give write permission to /etc/systemd/system/
folder.
# List ACLs
getfacl /etc/systemd/system
getfacl: Removing leading '/' from absolute path names
file: etc/systemd/system
owner: root
group: root
user::rwx
group::r-x
other::r-x
Add 'webmasters' group to an ACL
sudo setfacl -m g:webmasters:rwx /etc/systemd/system
Check
getfacl /etc/systemd/system
getfacl: Removing leading '/' from absolute path names
file: etc/systemd/system
owner: root
group: root
user::rwx
group::r-x
group:webmasters:rwx
mask::rwx
other::r-x
sudo -u username touch /etc/systemd/system/test.txt # should work
sudo -u username touch /etc/systemd/test.txt # Permission denied
Original how-to.
chown :groupname ./folder
and that didnt work - as in it changed the group, but didn't give any effective permissions – user230910 Nov 17 '19 at 21:03ls -l ./folderA
to ensure that the group permissions were applied? – Charles Green Nov 24 '20 at 01:44touch test.txt
, I get the error:touch: cannot touch 'test.txt': Permission denied
. I'm trying to give access to the groupappowners
. This is the output ofls -al
:drwxrwxr-x 2 root appowners 4096 Apr 18 22:38 src
. EDIT: The reason was, if a user is added to a new group, they must re-login to receive the new group permissions. – Caleb Jay Apr 18 '22 at 21:50