I'm thinking your problem is that chpasswd only works for existing users.
You could probably add newusers to your packages, and have your script
something like:

#!/bin/sh

echo "admin:admin:::Admin User:/home/admin:/bin/bash" | newusers

newusers takes a line that looks like an /etc/passwd entry, but has the
password in cleartext and will fill omitted fields with sensible defaults.

I have my script (using chpasswd because I'm just changing the password for
root) in config/hooks/live/95accounts.hook.chroot.

On Tue, Nov 19, 2024 at 2:23 AM Robert Spiteri <rspiter...@gmail.com> wrote:

> Can someone please guide me on this?
>
> I want to change the default username and password instead of the
> user/live.
>
> I do not want to use the boot parameters but would like to have everything
> done using files and hooks.
>
> There is multiple documentation online and not all is correct/updated it
> seems.
>
> So far I tried this but nothing is working:
>
> Created a file:
> *config/includes.chroot_after_packages/etc/live/config.conf.d/10-user-setup.conf*
> with the below:
>
> LIVE_HOSTNAME="debianbox"
> LIVE_USERNAME="admin"
> LIVE_USER_FULLNAME="Administrator"'
>
> Created a file:
> *config/includes.chroot_after_packages/lib/live/config/2000-passwd* with
> the below:
> #!/bin/sh
>
> live-config hook: passwd
> echo "admin:admin" | chpasswd
> echo "root:ADMIN" | chpasswd
>

Reply via email to