7 releases (stable)

1.4.0 Jul 25, 2022
1.3.1 Mar 25, 2021
1.3.0 Mar 23, 2018
1.2.0 Sep 26, 2017
0.1.0 Sep 25, 2017

#724 in Filesystem

Download history 35873/week @ 2025-12-08 31023/week @ 2025-12-15 20021/week @ 2025-12-22 15513/week @ 2025-12-29 32622/week @ 2026-01-05 27962/week @ 2026-01-12 19701/week @ 2026-01-19 22395/week @ 2026-01-26 29765/week @ 2026-02-02 29666/week @ 2026-02-09 30672/week @ 2026-02-16 43800/week @ 2026-02-23 33974/week @ 2026-03-02 32580/week @ 2026-03-09 32031/week @ 2026-03-16 33239/week @ 2026-03-23

134,948 downloads per month
Used in 203 crates (7 directly)

CC-PDDC license

10KB
130 lines

Safe interface to <pwd.h>

This module, named after the python module with the same function, is a safe interafce to pwd.h on unix-y systems. Currently nothing from this module compiles on Windows, or attempts to make any kind of similar interface for Windows.


pwd module for unix-y systems

link link="https://deps.rs/repo/gitlab/pwoolcoc/pwd",alt="dependency status"

This is a small veneer over pwd.h, mostly just hides away the unsafe parts.

Installation

In the [dependencies] section of your Cargo.toml, add the following line:

[source="rust"]

[dependencies]
pwd = "1"

Usage

[source="rust"]

use pwd::Passwd;

fn main() {
    let me = Passwd::current_user();
    println!("my username is {}, home directory is {}, and my shell is {}. My uid/gid are {}/{}",
             me.name, me.dir, me.shell, me.uid, me.gid);
}

Dependencies

~135–550KB
~13K SLoC