hpc / mpifileutils

File utilities designed for scalability and performance.
https://hpc.github.io/mpifileutils
BSD 3-Clause "New" or "Revised" License
162 stars 64 forks source link

Feature Request: dchmod: Add ability to set the SETUID/SETGID bits #544

Open cmharr opened 1 year ago

cmharr commented 1 year ago

Currently, there doesn't seem to be a way to set the SETUID or SETGID bits on file permissions, i.e. u+s and g+s. We use that feature on various large file systems, so it would be helpful to have this option available when updating a large directory tree.

From the chmod man page:

SETUID AND SETGID BITS
       chmod clears the set-group-ID bit of a regular file if the file's group ID does not match the user's effective group ID or one  of  the  user's
       supplementary  group  IDs, unless the user has appropriate privileges.  Additional restrictions may cause the set-user-ID and set-group-ID bits
       of MODE or RFILE to be ignored.  This behavior depends on the policy and functionality of the underlying chmod system  call.   When  in  doubt,
       check the underlying system behavior.

       chmod  preserves  a  directory's set-user-ID and set-group-ID bits unless you explicitly specify otherwise.  You can set or clear the bits with
       symbolic modes like u+s and g-s, and you can set (but not clear) the bits with a numeric mode.