Crate file_owner[][src]

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

Group of a file.

Owner

Owner of a file.

Enums

FileOwnerError

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.