Help > Beginners

How to allows booting with empty passwords on your own ISOs

(1/1)

dufresnep:
NuTyX handle user creation, and asking a password for it, through setup-nutyx -cu or setup-nutyx --create-user
which is caling setup-user inside the setup-nutyx bash script.
I think this is what is called by the nu (new user) alias(?).

Anyway... here is my modified setup_password function that allows empty password:

--- Code: ---setup_password()
{
local PASSWORD CONFIRM_PASSWORD RESULT

PASSWORD=""
CONFIRM_PASSWORD=""
RESULT="false"

while [ "$RESULT" == "false" ];
do
exec 3>&1
PASSWORD=`dialog --title "  $(gettext "Password") " \
--insecure "$@" \
--passwordbox "  $(gettext "Enter a new password"):" 8 60  2>&1 1>&3`
CONFIRM_PASSWORD=`dialog --title "  $(gettext "Password") " \
--insecure "$@" \
--passwordbox "$(gettext "Confirm the new password"):" 8 60 2>&1 1>&3`

if [ "$PASSWORD" == "$CONFIRM_PASSWORD" ]; then
RESULT="true"
else
dialog --msgbox "$(gettext "Passwords are differents, please try again")" 5 60
fi
done

        if [ -z "$PASSWORD" ]; then
            # empty password
            passwd -d "$NAME"
        else
            # password is not empty
          echo -e "$PASSWORD\n$CONFIRM_PASSWORD"|passwd "$NAME" 2> /dev/null
        fi
        $SETUP_LOG "setup-nutyx --create-user" "$NAME password changed"

}
--- End code ---

I added the if [ -z "$password"] at the end to test for empty password. In that case, I do passwd -d username to delete (make it empty string) it.

But alone this not works because the system does not authorize empty passwords.
To authorize empty password I edited the file /etc/pam.d/system-auth as follows:

--- Code: ---# Begin /etc/pam.d/system-auth

auth      required    pam_unix.so nullok

# End /etc/pam.d/system-auth

--- End code ---
I added the nullok to allow to login with empty passwords.


Thierry:
Thank you very much for your efforts. Even if I'm not very active at the moment. I appreciate your reseach and Investigation.

I see now what is wrong with the install-nutyx script documentation. Will need to review completly this page.

Navigation

[0] Message Index

Go to full version