From 1359501d3faa1e89e5aeb670e54883a3ee7b7c2c Mon Sep 17 00:00:00 2001 From: MggMuggins Date: Wed, 25 Jul 2018 15:20:15 -0500 Subject: [PATCH] Use shadowfile for user creation --- src/install.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/install.rs b/src/install.rs index ad76f808c8..2282dd4685 100644 --- a/src/install.rs +++ b/src/install.rs @@ -163,6 +163,7 @@ pub fn install, S: AsRef>(config: Config, output: P, cookboo } let mut passwd = String::new(); + let mut shadow = String::new(); let mut next_uid = 1000; for (username, user) in config.users { let password = if let Some(password) = user.password { @@ -195,11 +196,17 @@ pub fn install, S: AsRef>(config: Config, output: P, cookboo dir!(home.trim_matches('/')); - passwd.push_str(&format!("{};{};{};{};{};file:{};file:{}\n", username, password, uid, gid, name, home, shell)); + passwd.push_str(&format!("{};{};{};{};file:{};file:{}\n", username, uid, gid, name, home, shell)); + shadow.push_str(&format!("{};{}\n", username, password)); } - if ! passwd.is_empty() { + + if !passwd.is_empty() { file!("etc/passwd", passwd.as_bytes(), false); } - + + if !shadow.is_empty() { + file!("etc/shadow", shadow.as_bytes(), false); + } + Ok(()) }