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. ?
Changing root password (at build time) on luckfox pico
Hello, and thank you for exploring Luckfox-Sdk.ACBIAS wrote: ↑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. ?
The first and second questions can be answered together. The root password defined in buildroot is overridden by our default setting in shadow_defconfig. Therefore, modifying buildroot is ineffective.
The reason for this setup is that the compiler for RV1106 uses a separate encryption method, rkcrypto, for rootfs construction. If you use a rootfs with your own password setting, it won't be possible to log in with the preset password because the decoding algorithm differs from rkcrypto, resulting in failed authentication.
If you need to make modifications, please execute the following commands on your PC (currently only tested on Ubuntu):
Code: Select all
openssl passwd -1 -salt dXmV8ZLO -table <yourpassword>
<yourpassword> xxxxxxxxxxxxx #output
Code: Select all
root:xxxxxxxxxxxxx:19664::::::