Thanks for the work in #6369. This patch enables to set a root password of an image and a default shell. You probably need to install the package whois on your building host to get mkpasswd for password generation.
Signed-off-by: Christoph König <[email protected]> --- Index: package/base-files/Makefile =================================================================== --- package/base-files/Makefile (revision 27124) +++ package/base-files/Makefile (working copy) @@ -42,6 +42,8 @@ $(call Config,network.lan.netmask,netmask,255.255.255.0,LAN Network Mask) $(call Config,network.lan.gateway,ip,,LAN Gateway) $(call Config,network.lan.dns,ip,,LAN DNS server) + $(call Config,root_password,string,,Default root password) + $(call Config,root_shell,string,/bin/ash,Default root shell) endef define Package/base-files/conffiles @@ -421,6 +423,8 @@ $(CP) $(PLATFORM_SUBDIR)/$(PROFILE)/base-files/* $(1)/; \ fi \ ) + $(SED) 's,^root:!:,root:$(shell mkpasswd "$(call qstrip,$(CONFIG_UCI_PRECONFIG_root_password))"):,' $(1)/etc/passwd + $(SED) 's,/bin/ash$$$$,$(call qstrip,$(CONFIG_UCI_PRECONFIG_root_shell)),' $(1)/etc/passwd # Form valid /etc/shadow entries, by copying the user:pw pairs # from /etc/passwd, and adding on pw change data $(if $(CONFIG_BUSYBOX_CONFIG_FEATURE_SHADOWPASSWDS), \ _______________________________________________ openwrt-devel mailing list [email protected] https://lists.openwrt.org/mailman/listinfo/openwrt-devel
