#shell #sudo #root #su #system #execute-command #super-user

super-shell

This library provides basic super-user shell access in rust

10 stable releases

1.2.4 Mar 31, 2024
1.2.3 Oct 26, 2023
1.2.2 Sep 25, 2023
1.2.0 Jul 24, 2023

#6 in #sudo

Download history 14/week @ 2024-02-13 12/week @ 2024-02-20 9/week @ 2024-02-27 6/week @ 2024-03-05 13/week @ 2024-03-12 8/week @ 2024-03-19 206/week @ 2024-03-26 46/week @ 2024-04-02

262 downloads per month

GPL-3.0 license

1MB
86 lines

This library provides basic super-user shell access in rust.

Example usage

use super_shell::RootShell;

fn main() {
    // Super user privileges are requested once via pkexec as default.
    let mut root_shell = RootShell::new().expect("Failed to create root shell");
    
    // All subsequent requests are executed as root user
    println!("{}", root_shell.execute("echo Hello $USER"));
    
    // Each command blocks until the response is fully received
    println!("{}", root_shell.execute("echo now sleeping for 3s ..."));
    root_shell.execute("sleep 3");
    println!("done")
}

Limitations

  • Currently only Linux is supported
  • No stderr handling
  • No sudo support

No runtime deps