From 1b1369d52c2a175e192802556cb63f2bf60dfb55 Mon Sep 17 00:00:00 2001 From: Daiane Angolini Date: Fri, 22 Oct 2021 11:16:32 -0300 Subject: ref-manual: Update how to set a useradd password Partial fix for [YOCTO 14605] (From yocto-docs rev: d9c7fba68ca7c901e9e7064fee2989d834d4684c) Signed-off-by: Daiane Angolini Reviewed-by: Michael Opdenacker Signed-off-by: Richard Purdie --- documentation/ref-manual/classes.rst | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'documentation') diff --git a/documentation/ref-manual/classes.rst b/documentation/ref-manual/classes.rst index 381c5d1dd7..694e20ebc3 100644 --- a/documentation/ref-manual/classes.rst +++ b/documentation/ref-manual/classes.rst @@ -590,19 +590,25 @@ Here is an example that uses this class in an image recipe:: " Here is an example that adds two users named "tester-jim" and "tester-sue" and assigns -passwords:: +passwords. First on host, create the password hash:: + + mkpasswd -m sha256crypt tester01 + +The resulting hash is set to a variable and used in ``useradd`` command parameters. +Remember to escape the character ``$``:: inherit extrausers + PASSWD = "\$X\$ABC123\$A-Long-Hash" EXTRA_USERS_PARAMS = "\ - useradd -P tester01 tester-jim; \ - useradd -P tester01 tester-sue; \ + useradd -p '${PASSWD}' tester-jim; \ + useradd -p '${PASSWD}' tester-sue; \ " -Finally, here is an example that sets the root password to "1876*18":: +Finally, here is an example that sets the root password:: inherit extrausers EXTRA_USERS_PARAMS = "\ - usermod -P 1876*18 root; \ + usermod -p '${PASSWD}' root; \ " .. _ref-classes-features_check: -- cgit v1.2.3-54-g00ecf