root pw + min
All checks were successful
ci/woodpecker/push/build Pipeline was successful

This commit is contained in:
JMARyA 2025-01-05 04:48:28 +01:00
parent a3da9fb9ac
commit 40a1498c6f
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
7 changed files with 72 additions and 15 deletions

View file

@ -4,6 +4,10 @@ use crate::{
print_status,
};
pub fn change_passwd(user: &str, pw: &str) {
arch_chroot(&["passwd", user], Some(&format!("{}\n{}\n", pw, pw)), false);
}
/// Setup the users of the system
pub fn setup_users(conf: &[UserConfig]) {
let mut doas_conf = String::new();
@ -11,11 +15,7 @@ pub fn setup_users(conf: &[UserConfig]) {
for user in conf {
arch_chroot(&["useradd", "-m", &user.name], None, false);
arch_chroot(
&["passwd", &user.name],
Some(&format!("{}\n{}\n", user.password, user.password)),
false,
);
change_passwd(&user.name, &user.password);
if user.doas_root {
print_status(&format!("Allowing root doas for {}", user.name));