M
M
MrFlatman2018-09-30 20:37:07
linux
MrFlatman, 2018-09-30 20:37:07

Changing permissions for a specific group in Linux?

Tell me, please, I can not figure out how the commands are written correctly. There are a couple of tasks:

  1. It is necessary to give the right to execute the file to a certain group
  2. Grant the right to modify a file to a specific user
  3. Grant read access to a file to a specific group
  4. Grant the right to modify and create files in a specific directory to a specific group

Thanks in advance. For a couple of hours I've been trying to find an answer, everywhere they give an example of something like "u + x", etc., but not words how to give a specific group

Answer the question

In order to leave comments, you need to log in

3 answer(s)
P
planc, 2018-09-30
@MrFlatman

u - user
g - group
o - others (others)
permissions:
r - read( read )
w - write( write )
x - execution (execution)
g+x - give permission to group to execute
gx - take permission from group to execute
from each file has uid( user id ) and gid(group id)
change owner: chown username file
change group: chgrp groupname file
Grant the right to modify a file to a specific user
if the user does not own this file, then you need to read about acl
or you can add the user to the group that owns the file and the group has rights

M
Michael Galyuk, 2018-10-01
@robux

1. File execution rights to the "staff" group :
Grant rights to the "staff" group: Grant
launch rights to the group:
Grant launch rights to everyone (including the group):
2. The right to modify the file to the user "user" :

chown user /home/user/scripts/script.sh
chmod u+rw /home/user/scripts/script.sh

3. The right to read the file to the "staff" group :
chown :staff /home/user/scripts/script.sh
chmod g+r /home/user/scripts/script.sh

4. The right to modify and create files in the ~/scripts directory for the "staff" group :
chown -R :staff /home/user/scripts
chmod -R g+rw /home/user/scripts

Details here:
man chown
man chmod

A
Alexander, 2020-07-21
@magrega

Tell me, how can I set the rights so that they are saved for new files in the folder? I have a mail folder /var/mail/Maildir with subfolders new, cur, tmp. All of these folders are given 775 permissions, but when new files get there, they are all read/write user-owner and you have to manually write chmod 775 to get the group access too.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question