X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=fai%2Fconfig%2Fscripts%2FDEBIAN%2F10-rootpw;h=329e2f6220caa87a16eaf66a13f4937e60d43e5e;hb=490334746631a6c956eee47947f3ab8f8a451666;hp=c1ee0b18f725043592835d9091eef6e53b60c7e5;hpb=056eb4e90e13b2d8f7cbb8c3b875f35bf0fa207e;p=automated-distro-installer diff --git a/fai/config/scripts/DEBIAN/10-rootpw b/fai/config/scripts/DEBIAN/10-rootpw index c1ee0b1..329e2f6 100755 --- a/fai/config/scripts/DEBIAN/10-rootpw +++ b/fai/config/scripts/DEBIAN/10-rootpw @@ -3,6 +3,15 @@ error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code # set root password -$ROOTCMD usermod -p "$ROOTPW" root +if [ -n "$ROOTPW" ]; then + $ROOTCMD chpasswd --encrypted <<< "root:${ROOTPW}" +elif [ -n "$username" ]; then + $ROOTCMD usermod -L root + # enable sudo for user + ainsl /etc/sudoers "$username ALL = ALL" + if [ ! -f $target/usr/bin/sudo ]; then + echo "WARNING. Package sudo is not installed" + fi +fi exit $error