Open coderjoe opened 12 months ago
Yes, 5 number style isn't supported at present and agree it should.
Haven't touched this project in a while but could you try to set the Mode = '-t'
A bit of a long shot really...
I have found no combination of functionality which allows me to unset suid or sgid bits on directories. I think the root cause of my problem is potentially three fold:
nxFileSystemMode
method toOctal()
is used to generate the mode to pass to chmod
but it does not differentiate between files and directories, so for files it will auto overwrite suid/sgid/sticky but on directories they will be maintainedSet-Chmod
only allows the mode set via octal representation from nxFileSystemMode
Therefore while it's possible to set sticky bits on directories, it does not seem possible to unset them.
In the interim I've abandoned trying to use nxFile related functionality and have just written an nxScript
to ensure the bits are unset.
We agree that 5 digits should be supported and are currently looking into this @coderjoe! Thank you for raising this issue with us
No problem. Thank you for your time, interest, and hard work. :)
Details of the scenario you tried and the problem that is occurring
I used
nxFile
to set a mode of 2740 to set sgid on a directory but I need to remove the sticky bit now. When I re-runnxFile
with a mode of 00740 to unset the sticky bits it fails saying 00750 is invalid. But the extra 0 is how chmod is told to clear existing sticky bits.From the manual page
man chmod
on Ubuntu 22.04:So for directories an extra zero or a leading = are valid specifiers.
Verbose logs showing the problem
Suggested solution to the issue
Either: Officially support both #### (4 number) style modes in nxFile so we can set suid/sgid/sticky bits AND officially support ##### (5 number) style modes so we can unset them OR Make it clear that neither 4 or 5 number style modes are supported
The DSC configuration that is used to reproduce the issue (as detailed as possible)
The operating system the target node is running
Version and build of PowerShell the target node is running
Version of the DSC module that was used