How can I set the default permissions for new files in a directory?

1

I have a local directory /var/foo

I'd like it so that any file created in here can be read and written by any user (and any directory can be rwx).

I've tried chacl -b u::rwx,g::rwx,o::rw- u::rwx,g::rwx,o::rwx /var/foo

and then when I run getfacl /var/foo it seems these permissions are there, but then I can't even ls /var/foo any more.

There are no existing files or directories in there, but there are going to be, and I need to make sure they are world-write and -readable.

Rory

Posted 2012-09-03T13:28:08.030

Reputation: 729

Answers

2

As documented in man setfacl you set default ACLs by prepending them with default:.

setfacl -m default:u::rwx,default:g::rwx /var/foo

Ansgar Wiechers

Posted 2012-09-03T13:28:08.030

Reputation: 4 860

Usage: setfacl [-bkndRLP] { -m|-M|-x|-X ... } file ... – Rory – 2012-09-03T14:48:40.893

1Should have been setfacl -m ..., @Blazemore. – user1686 – 2012-09-03T16:41:16.763

@grawity Indeed. I mistakenly skipped the -m when posting my answer. Thanks for fixing. – Ansgar Wiechers – 2012-09-03T16:57:03.853