0

How can I set default group owner & permissions for any new file created under /data/user-name/ ?

I want any new file created under /data/user-name/ to have the following properties: 1) group owner = marketing 2) owner permissions = rwx 3) group permissions = rwx 4) other permissions = r--

touch /data/user-name/test.file
ls -lah /data/user-name/test.file

should produce

-rwxrwxr--  1 username marketing     0B Apr  7 13:23 test.file

I cannot figure out how to accomplish this. Thank you!!!

1
  • That would require you set those permissions on the folder.
    – Ramhound
    Apr 7, 2017 at 22:43

1 Answer 1

0

Ownership and permissions are inherited from the parent directory where a file is created. So all you would need to do is apply the group:owner and the permissions rwxrwxr (or 774) to that parent directory and move on.

If you use SMB, it also has tooling to set permissions on any new file or folder but that's beyond the scope of your question. I just thought I would mention in case it's useful.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.