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(),