I have a folder called "post", when I write getfacl post I get these results:

# file: post
# owner: www-data
# group: ftpgroup
# flags: -s-

As you can see there is a -s- flag, and the default permission for group is rwx, so new files should be 775.

If I write ls -lha I got these perms:

drwxrwsr-x+ 22 www-data ftpgroup 4.0K Dec  3 20:56 post

as you can see, another s appears, when I create a new folder (using a different user in the same group) perms goes 755 instead of 775.

I think this flag is doing something wrong, How to remove it?


An s flag located on the group octet is called the SET-GID bit. Any new files created in a directory with the SET-GID bit set will be owned by the group who owns the parent directory. Also, any new sub-directories will inherit the SET-GID bit.

To add the SET-GID bit you can use:

chmod g+s directory

To remove the SET-GID bit you can use:

chmod g-s directory

In regard to getting 755 instead of 775 permissions, check the umask of the system. The umask you are looking for is 002.

You can make the umask permanent for the user by placing umask 002 in ${HOME}/.bashrc or ${HOME}/.profile, or make it the system default by placing it in /etc/bashrc or /etc/profile.

| improve this answer | |
  • It is odd that the accepted answer offers no explanation of why the created directory has r-x rather than rwx group access, seemingly the core of the question. melds's answer does. – JdeBP Dec 4 '18 at 12:03
  • 1
    @JdeBP: To be honest, I read right over that when I answered. See my latest edit. I go into more detail on the umask portion. I appreciate you pointing that out. – Peschke Dec 4 '18 at 14:12

The 's' flag on a folder is the SETGID flag and is like the sticky bit (How does the sticky bit work?) and changes how ownership and permissions word in the folder (SETGID forces file created in the folder to have the same group membership).

You can remove it by doing a chmod 0775 or chmod g-s to the parent directory.

You also may want to look at the other user's umask setting if other flags aren't being set the way you'd want.

| improve this answer | |
  • 1
    The sticky bit is represented by a t. s is the set user or group ID bit. – Peschke Dec 3 '18 at 22:00
  • 1
    @Peschke You're right. I tend to use the wrong term for persistent flags like this. I'll update my answer. – melds Dec 3 '18 at 22:07

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.