change password to take hashed password

axtloss/rework-partitioning
axtlos 3 years ago
parent 2f9b42e11a
commit ef4159978d
No known key found for this signature in database
GPG Key ID: A468AFD71DD51D4A

@ -9,6 +9,8 @@ pub fn new_user(username: &str, hasroot: bool, password: &str) {
String::from("-m"),
String::from("-s"),
String::from("/bin/bash"),
String::from("-p"),
String::from(password),
String::from(username),
],
),
@ -36,19 +38,6 @@ pub fn new_user(username: &str, hasroot: bool, password: &str) {
"Add pwfeedback to sudoers",
);
}
exec_eval(
exec_chroot(
"bash",
vec![
String::from("-c"),
format!(
r#"'usermod --password $(echo {} | openssl passwd -1 -stdin) {}'"#,
password, username
),
],
),
format!("Set password for user {}", username).as_str(),
);
}
pub fn root_pass(root_pass: &str) {
@ -58,8 +47,7 @@ pub fn root_pass(root_pass: &str) {
vec![
String::from("-c"),
format!(
r#"'usermod --password $(echo {} | openssl passwd -1 -stdin) root'"#,
root_pass
r#"'usermod --password {root_pass} root'"#
),
],
),

@ -119,7 +119,7 @@ fn main() {
)
.arg(
Arg::with_name("password")
.help("The password to set")
.help("The password to set. NOTE: Takes hashed password, use `openssl passwd -1 <password>` to generate the hash.")
.required(true),
)
)
@ -128,7 +128,7 @@ fn main() {
.about("Set the root password")
.arg(
Arg::with_name("rootPass")
.help("The root password to set")
.help("The password to set. NOTE: Takes hashed password, use `openssl passwd -1 <password>` to generate the hash._")
.required(true),
),
)

Loading…
Cancel
Save