diff --git a/xCAT-server/lib/xcat/plugins/packimage.pm b/xCAT-server/lib/xcat/plugins/packimage.pm index 5ce102c59..568611619 100644 --- a/xCAT-server/lib/xcat/plugins/packimage.pm +++ b/xCAT-server/lib/xcat/plugins/packimage.pm @@ -94,11 +94,19 @@ sub process_request { if ($pent and defined ($pent->{password})) { my $pass = $pent->{password}; my $shadow; + open($shadow,"<","$installroot/netboot/$osver/$arch/$profile/rootimg/etc/shadow"); + my @shadents = <$shadow>; + close($shadow); open($shadow,">","$installroot/netboot/$osver/$arch/$profile/rootimg/etc/shadow"); unless ($pass =~ /^\$1\$/) { $pass = crypt($pass,'$1$'.genpassword(8)); } print $shadow "root:$pass:13880:0:99999:7:::\n"; + foreach (@shadents) { + unless (/^root:/) { + print $shadow "$_"; + } + } close($shadow); } }