Crate file_owner[][src]

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

Group of a file.

Owner of a file.

Enums

File owner or group error.

Traits

Extension methods for T: AsRef<Path>.

Functions

Gets group of a file at the given path.

Gets owner of a file at the given path.

Gets owner and group of a file at the given path.

Sets group to file at the given path.

Sets owner to file at the given path.

Sets owner and group to file at the given path.