The standard library provides a way to change file permissions, so I'm wondering if I'm missing something.
Some OS specific funtionality can be found in the std::os
module: for example std::os::unix::fs::MetadataExt
allows to read uid
/ guid
or std::os::unix::fs::PermissionsExt
handles file modes. However AFAIK there is no std
support for changing owner / group.
As PeterHall commented, there is a chmod
(and chown
) function in the libc
crate.
For further examples and inspiration, I suggest you to have a look to the coreutils project that implements many common GNU CLI utils, among which you can find the metadata manipulation ones.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With