Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Inheriting Group Permission from Directory Using Setgid (g+s) in emulation layer #133

Open
mcandeia opened this issue Nov 11, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@mcandeia
Copy link
Contributor

https://en.wikipedia.org/wiki/Setuid#setuid_and_setgid_on_directories

Example

When the setgid bit (g+s) is set on a directory, any new files or subdirectories created within it should automatically inherit the directory's group rather than the group of the user creating the file. This behavior is useful for shared directories where consistent group ownership is needed (e.g., collaborative environments or web directories).

// Set up directory with setgid
await fs.chmod('/var/www', 0o2775);
await fs.chown('/var/www', 33, 33); // 33 is the default www-data user/gid on unix

// Expected behavior: Files created in '/var/www' inherit group from directory
await fs.writeFile('/var/www/app/index.html', '<html><body>hello</body></html>');
const stat = await fs.stat('/var/www/app/index.html');
console.log(stat.gid); // Should match gid of /var/www
@james-pre james-pre changed the title [feature-request] Support for Inheriting Group Permission from Directory Using Setgid (g+s) in Filesystem API Emulation Support for Inheriting Group Permission from Directory Using Setgid (g+s) in emulation layer Nov 11, 2024
@james-pre james-pre added the enhancement New feature or request label Nov 11, 2024
@james-pre
Copy link
Member

5b4e391 adds support to StoreFS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants