1

In unices, do new folders/files inherit parent permissions?

What about groups and owners? (maybe those don't qualify as permissions...?)

2 Answers 2

2

Permissions on UNIX and UNIX-like systems aren't inherited. All new folders and files created use the umask value to determine the default permissions they will be created with.

The umask value is subtracted from 777 (full rwx permissions for everyone) to set a directory's default permissions, and from 666 for a file's default permissions. This is a security feature so files don't get execute permissions unless explicitly set.


To answer your edit, no, group and owner permissions are not inherited either.

2

Not really, no. However, some directory permissions are particularly important in regards to this: g+s makes new files in a directory be group-owned by the directory's group. u+s would do the same but for user-ownership, except that it's not supported on Linux. x on a directory will control traversal -- the ability of people to look "through" that directory to files underneath it. r is used to allow listing a directory. t can be used to prevent deleting files in a directory if a user doesn't own (i.e., didn't create, usually) the file.

Groups and owners definitely count as part of the permissions system. In fact, you'll need to create lots of groups to get fine-grained permissions on unix, unless you want to use ACLs instead. Or unless your needs simply aren't complex, of course. For example, if your file is owned by bob:users, and you need to add the staff group as legitimate readers, but don't want to allow access to others, then all you can really do is create an additional group containing everyone from staff and users, and give that group ownership of the file. ACLs handle this more elegantly, and I think systems like NFS allow groups to contain other groups (which makes this sort of group hack much cleaner and easier to maintain).

You must log in to answer this question.

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