diff --git a/src/functions/users.rs b/src/functions/users.rs index 94e67cf..129e97f 100755 --- a/src/functions/users.rs +++ b/src/functions/users.rs @@ -56,16 +56,10 @@ pub fn root_pass(root_pass: &str) { "bash", vec![ String::from("-c"), - String::from("'usermod"), - String::from("--password"), - String::from("$(echo"), - String::from(root_pass), - String::from("|"), - String::from("openssl"), - String::from("passwd"), - String::from("-1"), - String::from("-stdin)"), - String::from("root'"), + format!( + "'usermod --password $(echo {} | openssl passwd -1 -stdin) root'", + root_pass + ), ], ), "set root password", diff --git a/src/main.rs b/src/main.rs index 18dfd88..13230a8 100755 --- a/src/main.rs +++ b/src/main.rs @@ -179,8 +179,6 @@ fn main() { app.value_of("password").unwrap(), ); } else if let Some(app) = app.subcommand_matches("rootPass") { - let rootpass = app.value_of("rootPass").unwrap(); - println!("{}", rootpass); users::root_pass(app.value_of("rootPass").unwrap()); } } else if let Some(app) = app.subcommand_matches("desktops") {