Skip to content

Apply chown before chmod in syncfileclient permission handling - #263

Merged
jjohnson42 merged 1 commit into
xcat2:masterfrom
Obihoernchen:syncfiles2
Aug 4, 2026
Merged

Apply chown before chmod in syncfileclient permission handling#263
jjohnson42 merged 1 commit into
xcat2:masterfrom
Obihoernchen:syncfiles2

Conversation

@Obihoernchen

Copy link
Copy Markdown
Member

chown() clears the setuid bit of a file on Linux (and its setgid bit, if the file is group-executable), even when run by root and even when the owner/group are unchanged. Since the owner/group chown ran after the permissions chmod, any syncfiles entry combining owner=/group= with a setuid/setgid permissions= value silently lost the special bits.

E.g.:

/usr/local/bin/ws_allocate -> login,compute:/usr/local/bin/ws_allocate (owner=root,group=root,permissions=4755)

Would set 0755 instead.

/usr/local/bin/ws_allocate -> login,compute:/usr/local/bin/ws_allocate (permissions=4755)

works.

chown() clears the setuid bit of a file on Linux (and its setgid bit, if
the file is group-executable), even when run by root and even when the
owner/group are unchanged. Since the owner/group chown ran after the
permissions chmod, any syncfiles entry combining owner=/group= with a
setuid/setgid permissions= value silently lost the special bits.
@jjohnson42
jjohnson42 merged commit b85f15f into xcat2:master Aug 4, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants