0

I am on Mac OS Lion and wants to prevent users from creating sub directories inside a folder but at the same time users should be able to add files to the same directory

The following command does not allow user to add files to the folder

chmod +a "user allow add_file" test

What should I do to allow users to add files and not sub directories?

here are links to
Screen Shot 1
Screen Shot 2

1

EDIT: The following is a partial solution. It will work at the shell level as expected but in Finder it can be bypassed with the if user is admin or knows the a admin user id & password. See comments below...

Check the man page on chmod and you will find...

 The following permissions are applicable to directories:
       list    List entries.
       search  Look up files by name.
       add_file
               Add a file.
       add_subdirectory
               Add a subdirectory.
       delete_child
               Delete a contained object.  See the file delete permission
               above.

So the command you are looking for is...

$ chmod +a "staff deny add_subdirectory" test

to forbid anyone in group staff from creating sub folder and then testing should give you

$ mkdir test/subtest
mkdir: test/subtest: Permission denied

Where as creating a file...

$ touch test/blah.txt
$ 

is no problem. You should also find that Finder will have the Create Folder option disabled as well.

HTH

  • Terminal is behaving as expected but not Finder. When I copy a file using Finder it asks me for a password, although it allows me to move a file cmd+shift+v which I can't understand why? – Nisar Ahmed Jan 11 '15 at 19:49
  • Yeah I just noticed too on my OSX 10.6.8, Finder will disable the New Folder action but will allow to move a folder if you authenticate. Strange. It may have something to do with ownership. I'll check tomorrow and report back. – Vic Jan 11 '15 at 22:57
  • No luck. As long as the user is or has access to an admin account they can bypass this. So it is a partial solution. – Vic Jan 17 '15 at 18:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .