Warning
This post was published 41 days ago. The information described in this article may have changed.
I'm trying to create a file (if it doesn't exist) on Windows - so far, so good. But I'd like that file to be readable by everyone else. And that last bit is where I'm hitting a snag. I'd like to create a file in a public location (e.g. a location that other users can at least see; not all that different from log files. Which seems like it should be basic multi-user system functionality?%PUBLIC%/shared_info.txt
)
Looking at OpenOptionsExt
and the MS docs it links, I can set the permissions for other processes (presumably under the same user) while I hold the handle. But I can't find anything about managing user permissions. There's an old crate windows-permissions but the docs seem to imply it's only for reading permissions similar to e.g. faccess
.
Is there any way to manage user permissions on Windows short of hacking something together myself over the windows
crate?
edit: Turns out the example %PUBLIC%
causes inheritance of the file being created - if it's initially created there. The MS docs on ACLs only say it's possible to inherit. So I figured I'd just run icacls
as a subprocess to make it happen. And then ss64 had some great news
By default, an object will inherit permissions from its parent object, either at the time of creation or when it is copied or moved. The only exception to this rule occurs when you move an object to a different folder on the same volume.
That said, I would still like to mangle permissions if possible, so consider the question still open
1 post - 1 participant
🏷️ rust_feed