You are not logged in.

#1 2014-07-14 15:12:55

Soukyuu
Member
Registered: 2014-04-08
Posts: 854

[Solved]Change default permissions for new files within a folder only?

What I am trying to do is to create a folder which every user can write into/read/execute from no matter who created the file.
I tried setting the permission of the folder to 2777, thinking it would also make the new files with the GID bit set, but all new files and folders are created with rwxr--r--

The folder is also shared via samba with full permissions to all registered users and if user A creates a file on the share, user B can read it, but not execute it without copying it over to their PC.
What is the correct way to set the permissions in my case?

Last edited by Soukyuu (2014-07-16 21:21:53)


[ Arch x86_64 | linux | Framework 13 | AMD Ryzen™ 5 7640U | 32GB RAM | KDE Plasma Wayland ]

Offline

#2 2014-07-14 15:22:18

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [Solved]Change default permissions for new files within a folder only?

Formatting the device / partition as fat could help ;P
You can try running a cronjob or using inotify to set the right permissions, but I'm not sure if it's the correct way.

Offline

#3 2014-07-14 20:00:45

Soukyuu
Member
Registered: 2014-04-08
Posts: 854

Re: [Solved]Change default permissions for new files within a folder only?

I prefer the higher robustness of ext4, thanks ;P
Searching around, I found this, which is exactly what I needed.

Basically, verify ext4 is mounted with user_xattr and acl

# tune2fs -l /dev/sdb1 | grep acl
Default mount options:    user_xattr acl

Then run

# sudo setfacl -Rm g:sambashare:rwX,d:g:sambashare:rwX /data/Share/

Tested and it gives me the correct permissions on newly created files. Any downsides to this approach? Otherwise, I'll consider this solved.


[ Arch x86_64 | linux | Framework 13 | AMD Ryzen™ 5 7640U | 32GB RAM | KDE Plasma Wayland ]

Offline

#4 2014-07-14 20:57:27

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: [Solved]Change default permissions for new files within a folder only?

If this is just a samba thing, there are the 'create mask' and 'directory mask' options for shares in smb.conf.


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#5 2014-07-14 21:12:35

Soukyuu
Member
Registered: 2014-04-08
Posts: 854

Re: [Solved]Change default permissions for new files within a folder only?

It's a mix of both. I have the masks set in smb.conf, but sometimes the files are created by a user logged in on the server, which leads to my problem. Thanks for mentioning that though.


[ Arch x86_64 | linux | Framework 13 | AMD Ryzen™ 5 7640U | 32GB RAM | KDE Plasma Wayland ]

Offline

#6 2014-07-15 10:49:13

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: [Solved]Change default permissions for new files within a folder only?

You could look into incrond and see if you can manage to make it chmod files on creation. I know it can do it for a watched directory but I don't know if it can do it recursively.


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#7 2014-07-15 11:42:18

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [Solved]Change default permissions for new files within a folder only?

If extended attributes work for him, there's no need to dabble with inotify. According to wikipedia, it doesn't support recursively watching directories.

Offline

#8 2014-07-16 21:21:35

Soukyuu
Member
Registered: 2014-04-08
Posts: 854

Re: [Solved]Change default permissions for new files within a folder only?

Thanks for the replies, I'll go with extended attributes.


[ Arch x86_64 | linux | Framework 13 | AMD Ryzen™ 5 7640U | 32GB RAM | KDE Plasma Wayland ]

Offline

Board footer

Powered by FluxBB