Repository navigation
[BUGFIX] Keep the setgid bit for deploy users outside the group - #59
Merged
Merged
Conversation
A deploy user who is not a member of the siteroot's group (e.g. www-data) got release directories without the setgid flag, so every deeper level ended up in the user's own group. Linux drops the setgid bit when a non-member changes a directory's mode, and rsync --perms --chmod always did: on the release root (created at the remote umask, 2755) and on every subdirectory (rsync creates them with temporary modes and fixes them up). Create the release root and its directory tree with mkdir under a umask derived from dir_mode instead. Directories inherit setgid and group from their parent and already have the final mode, so rsync leaves them alone. The integration tests deployed as root, which never loses the bit. Add a non-root deploy user to the test image and cover this case. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
|
@liayn do you mind having a quick look before i merge this? |
liayn
approved these changes
Nov 13, 2026
liayn
left a comment
Contributor
There was a problem hiding this comment.
Without studying every test in detail, this sounds very reasonable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A deploy user who is not a member of the siteroot's group (e.g. www-data) got release directories without the setgid flag, so every deeper level ended up in the user's own group. Linux drops the setgid bit when a non-member changes a directory's mode, and rsync --perms --chmod always did: on the release root (created at the remote umask, 2755) and on every subdirectory (rsync creates them with temporary modes and fixes them up).
Create the release root and its directory tree with mkdir under a umask derived from dir_mode instead. Directories inherit setgid and group from their parent and already have the final mode, so rsync leaves them alone.
The integration tests deployed as root, which never loses the bit. Add a non-root deploy user to the test image and cover this case.