Expand description
Set and get Unix file owner and group.
UID/GUI numbers or user/group names can be used.
Note: This crate will only compile on Unix systems.
§Usage examples
§Set owner and group by name
use file_owner::PathExt;
"/tmp/baz".set_owner("nobody").unwrap();
"/tmp/baz".set_group("nogroup").unwrap();
§Set owner and group by id
use file_owner::PathExt;
"/tmp/baz".set_owner(99).unwrap();
"/tmp/baz".set_group(99).unwrap();
§Get owner and group
use file_owner::PathExt;
let o = "/tmp/baz".owner().unwrap();
o.id(); // 99
o.name(); // Some("nobody")
let g = "/tmp/baz".group().unwrap();
g.id(); // 99
g.name(); // Some("nogroup")
Structs§
Enums§
- File
Owner Error - File owner or group error.
Traits§
- PathExt
- Extension methods for
T: AsRef<Path>
.
Functions§
- group
- Gets group of a file at the given path.
- owner
- Gets owner of a file at the given path.
- owner_
group - Gets owner and group of a file at the given path.
- set_
group - Sets group to file at the given path.
- set_
owner - Sets owner to file at the given path.
- set_
owner_ group - Sets owner and group to file at the given path.