Hi,
I am new to lede and trying to use openwrt for a fun project. The target board is rpi-b+ and it works as expected. However, there is no default password on the openwrt and have to set it up after booting the device. I know lede has the /etc/passwd and /etc/shadow file in the base-files package.
It would be great if someone can suggest me the way to update these two file to provide a default root password built into the firmware.
First set the password is a live router, then copy /etc/passwd and /etc/shadow from the router to your build environment and include them in the firmware build as custom files.
Thank you for your reply,
But it is not working always. I flashed the binaries 4 times, non of them had the password I provided. Also the sha256 sum is different after running -
make packages/base-files/{clean,compile} V=99
The compared files are {lede-buildroot}/build_dir/linux-bcm**/base-files**/etc/{shadow, passwd} and {lede-buildroot}/files/etc{shadow,passwd}
"Custom files" from {lede-buildroot}/files are not part of base-files package, but they are just inserted into the rootfs file system after all packages, including base-files, have been installed during the final make step. You need to make the whole firmware image, not just base-files. And then look at the root file system, not the contents of base-files (which only contains the "normal" default files).
E.g. in my ipq806x R7800, the custom files are in
build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/root-ipq806x/etc/
So, your {lede-buildroot}/build_dir/target**/linux-bcm**/base-files**/etc/{shadow, passwd} looks wrong. The correct place would be something like {lede-buildroot}/build_dir/target**/root-bcm**/etc/{shadow, passwd}
(Note, I corrected your path above to include the missing target that you had skipped.)
As well as copying the image /etc/passwd and /etc/shadow into files/etc/
I added files/etc/login.defs with ENCRYPT_METHOD MD5
and I use the following script to create a passwd: