I came across the following task:

Add 3 new users - alice, bob, charles

  • Create a new group - marketing - and add alice, bob and charles to that group
  • Create a directory - /marketing - whose owner is alice and group is marketing

  • Set appropriate permissions so that the marketing group can share documents in the new directory but nobody else can see the documents.

  • Give charles read-only permission.

  • Create an empty file in /marketing named "empty".

Here is my answer:

  • useradd alice
  • useradd bob
  • useradd charles
  • mkdir /marketing
  • chown alice:marketing /marketing
  • chmod g=rwx,o=x /marketing
  • setacl -m u:charles:r d /marketing
  • touch /marketing/empty

I guess I got everything right except to give charles only read permissions.

As you can see in my answer I did using acls, however, since charles is also the marketing group, i believe it ignores the acls, because I switches to user Charles and I was able to create a file in /marketing.

That makes me question if the task itself doesn't make sense!

or do i have to remove charles from the marketing group?

  • Which OS is this? That should work (and it does on, e.g., Linux and with setfacl, at least on an ACL-capable filesystem). But POSIX never finished an ACL standard, so there isn't actually a standard behavior. (And you want rx not just r) – derobert Mar 13 at 22:08
  • This is centos 7 – alkabary Mar 13 at 22:10
  • Then it should work. What is setacl? Do you mean setfacl? In which case you've got a mistake in the syntax. – derobert Mar 13 at 22:12
  • (Try setfacl -m u:charles:rx /marketing — presumably Charles should be able to access the directory and its contents, not just list them, hence the x as well) – derobert Mar 13 at 22:16
  • @derobert You are correct, the POSIX ACL proposal from 1993 has been withdrawn in 1997. Modern OS use the ACL definitions from the NFSv4 standard that is bitwise identical to NTFS ACLs. – schily Mar 21 at 14:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.