0

The closest I got was umask to change the default permissions set for files/folders. However, umask doesn't seem to allow enabling the x bit for files:

The base permissions for directories are 0777 (rwxrwxrwx) and for files they are 0666 (rw-rw-rw-). Reference

I also saw this Ask Ubuntu post which makes sense, but still, umask clearly has an involvement in the issue, not just touch's code, because when I change umask, touch's results are affected).

Is there any way to create files with the execution bit set, at least for the user section (ideally -rwx-r-x-r-x = 755)

0

1 Answer 1

1

Is there any way to create files with the execution bit set, at least for the user section (ideally -rwx-r-x-r-x = 755)

Yes.

setfaclcommand will do what you want. See man setfacl for a complete manual.

sudo setfacl -Rdm g:groupnamehere:rwx /base/path/members/
sudo setfacl -Rm g:groupnamehere:rwx /base/path/members/

R is recursive, which means everything under that directory will have the rule applied to it. d is default, which means for all future items created under that directory, have these rules apply by default. m is needed to add/modify rules.

The first command, is for new items (hence the d), the second command, is for old/existing items under the folder. Hope this helps someone out as this stuff is a bit complicated and not very intuitive.

source

3
  • Not sure if I'm doing anything wrong here, but still, any new files being created with touch or gedit have none of the executable bits set.
    – bazz
    Feb 17, 2014 at 16:44
  • does it help to say that /etc/login.defs has USERGROUPS_ENAB yes
    – bazz
    Feb 17, 2014 at 16:47
  • Try to set the acl option in /etc/fstab at the filesystem.
    – NickTux
    Feb 17, 2014 at 20:10

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