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