Linux

How to set default group on new files or directory in Linux

I am managing a linux server where I want developers to run a springboot application which will generate files and folders. Those newly application created files and folders must inherit the parent group ID to let other developers manipulate the generated information.

chmod g+s is for setting and inheriting the setgid.
setfacl -m g::rwx is for setting the group access permission

Example:

In this example we assume that we already have a group named “devops”

sudo mkdir /company
sudo chgrp -R devops /company
sudo chmod -R g+s /company
sudo setfacl -m g::rwx /company

Any new folder or files created inside /company will have a default group devops
which has the permission to read, write and execute.