I got an exercise to create a directory called Projekte and I'm supposed to give the groups Auftrag and Support the permissions r and w but the others only r
I just realised that this is impossible. What can I do?
Thanks for any help
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
You would not be able to do this by creating a new group, as you need some users to have read and some to have read/write. That is unless you need the users from
Support to have read/write and everyone else to have read permissions, in which case you could create a group which contains all the users from
Support, and set group write and world read.
Alternatively, and assuming your filessytem supports them, you could use extended ACLs: https://wiki.archlinux.org/index.php/Access_Control_Lists
# setfacl -m "g:Auftrag:rw" /file/path # setfacl -m "g:Support:rw" /file/path
I have to assume that the goal includes the execute bit as well in order to change into the directory.
Become the root user.
Create the directory. (The root user is the owner and group owner.)
Define the permissions. Let's make it accessible only to root to highlight the affect of the ACLs.
Now augment standard permissions with ACLs.
setfacl -d -m g:Auftrag:7 Projekte setfacl -m g:Auftrag:7 Projekte setfacl -d -m g:Support:7 Projekte setfacl -m g:Support:7 Projekte setfacl -d -m o::5 Projeckte setfacl -m o::5 Projeckte
-m switch is the mask, and the
-d switch makes the mask the default mask for all new filesystem objects in the directory. Octal values need not be used. The same can be written as follows.
setfacl -d -m g:Auftrag:rwx Projekte setfacl -m g:Auftrag:rwx Projekte setfacl -d -m g:Support:rwx Projekte setfacl -m g:Support:rwx Projekte setfacl -d -m o::r-x Projeckte setfacl -m o::r-x Projeckte
The user, group, and other masks work the same way:
g:groupname:--- or in combination:
o means others. Not specifying a username or group name applies the mask to current user/group ownership.
Notice how both a mask and a default mask were applied. The mask (without
-d) applies to the directory itself. The mask (with
-d) applies to all new filesystem objects in the directory. It's easy to forget this.