Changing root password (at build time) on luckfox pico
Posted: 2024-04-23 9:05
I´d like to change the default "luckfox" password. Yes I know I can change the default password in the running system, but it´s not what I´m trying to achieve. I want to change it and the changes to be kept into my build.
I identified a place where the default root password is configured:
sysdrv/tools/board/buildroot/luckfox_pico_defconfig
When I change the hostname in this file (BR2_TARGET_GENERIC_HOSTNAME="my_new_hostname") then rebuild the image with build.sh (build.sh clean rootfs , then build.sh rootfs , then build.sh firmware) then flash it, the changes are effective.
But when I change the password (BR2_TARGET_GENERIC_ROOT_PASSWD="my_new_password") it has no effect.
(while writing the password in clear text in the buildroot config is a bad idea, one can use a crypt-encoded password if it´s prepended with $1$ (md5) $5$ (sha256) or $6$ (sha512)
Looks like the sysdrv/tools/board/buildroot/shadow_defconfig overrides the password, when building the rootfs.
So:
- why is the root password defined in buildroot config if it´s not used ?
- why not using the perfectly acceptable way of setting the root password within buildroot and override it with a shadow_defconfig snippet ?
- how to change the password (no, don´t tell my about changing it live in the console on the running luckfox pico, and no, i don´t want to manually generate a shadow_defconfig that overrides the buildroot mechanism, I want to use the standart way of buildroot to do that. ?
I identified a place where the default root password is configured:
sysdrv/tools/board/buildroot/luckfox_pico_defconfig
When I change the hostname in this file (BR2_TARGET_GENERIC_HOSTNAME="my_new_hostname") then rebuild the image with build.sh (build.sh clean rootfs , then build.sh rootfs , then build.sh firmware) then flash it, the changes are effective.
But when I change the password (BR2_TARGET_GENERIC_ROOT_PASSWD="my_new_password") it has no effect.
(while writing the password in clear text in the buildroot config is a bad idea, one can use a crypt-encoded password if it´s prepended with $1$ (md5) $5$ (sha256) or $6$ (sha512)
Looks like the sysdrv/tools/board/buildroot/shadow_defconfig overrides the password, when building the rootfs.
So:
- why is the root password defined in buildroot config if it´s not used ?
- why not using the perfectly acceptable way of setting the root password within buildroot and override it with a shadow_defconfig snippet ?
- how to change the password (no, don´t tell my about changing it live in the console on the running luckfox pico, and no, i don´t want to manually generate a shadow_defconfig that overrides the buildroot mechanism, I want to use the standart way of buildroot to do that. ?