From c123560b07ed61fe5b118eb54720f1d0dcf97fde Mon Sep 17 00:00:00 2001 From: amy Date: Sun, 23 Jan 2022 19:08:37 +0100 Subject: [PATCH] setting password works now --- src/functions/users.rs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/functions/users.rs b/src/functions/users.rs index 5d2b8d7..921f4f5 100755 --- a/src/functions/users.rs +++ b/src/functions/users.rs @@ -33,16 +33,10 @@ pub fn new_user(username: &str, hasroot: bool, password: &str) { "bash", vec![ String::from("-c"), - String::from("'usermod"), - String::from("--password"), - String::from("$(echo"), - String::from(password), - String::from("|"), - String::from("openssl"), - String::from("passwd"), - String::from("-1"), - String::from("-stdin)"), - format!("{}'", username), + format!( + r#"'usermod --password $(echo {} | openssl passwd -1 -stdin) {}'"#, + password, username + ), ], ), format!("Set password for user {}", username).as_str(),