On this page
Function std::os::unix::fs::lchown
pub fn lchown<P: AsRef<Path>>(
dir: P,
uid: Option<u32>,
gid: Option<u32>
) -> Result<()>
Available on Unix only.
Change the owner and group of the specified path, without dereferencing symbolic links.
Identical to chown
, except that if called on a symbolic link, this will change the owner and group of the link itself rather than the owner and group of the link target.
Examples
use std::os::unix::fs;
fn main() -> std::io::Result<()> {
fs::lchown("/symlink", Some(0), Some(0))?;
Ok(())
}
© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/os/unix/fs/fn.lchown.html