Set permissions on linux


Mon Jun 21 2021 20:32:43 GMT+0000 (UTC)

Saved by @dphillips #authentification #permissions

# Check if 'webmasters' group exist

cat /etc/group | grep webmasters

# Create 'webmasters' group

sudo addgroup webmasters

# Add users to 'webmasters' group

sudo usermod -a -G webmasters username

# Group assignment changes won't take effect
# until the users log out and back in.

# Change group owner of the directory to webmaster user

sudo chgrp -R webmasters /etc/nginx/
# Give write permission to the group

sudo chmod -R g+w /etc/nginx/
# Create file as different user

sudo -u username touch /etc/nginx/test.txt