From 634b7f1fdce6eb4416ea3c23f09b09fb879d8334 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: 3f3e5574ac9801ad92940168b61b532e0bd53a80) 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/ref-manual/classes.rst') diff --git a/documentation/ref-manual/classes.rst b/documentation/ref-manual/classes.rst index 79af45ada5..9b1ead66b3 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