From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 82B4AC4345F for ; Fri, 26 Apr 2024 19:22:38 +0000 (UTC) Subject: Re: [yocto] issue adding the user with the yocto kirkstone To: "Mahendra Sondagar" , yocto@lists.yoctoproject.org From: "Daniel" X-Originating-Location: Alajuela, Provincia de Alajuela, CR (201.204.89.104) X-Originating-Platform: Linux Firefox 125 User-Agent: GROUPS.IO Web Poster MIME-Version: 1.0 Date: Fri, 26 Apr 2024 12:22:31 -0700 References: <27643.1714153781642827519@lists.yoctoproject.org> In-Reply-To: <27643.1714153781642827519@lists.yoctoproject.org> Message-ID: <27643.1714159351905953827@lists.yoctoproject.org> Content-Type: multipart/alternative; boundary="btF4la24CZp93RgFnoPu" List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 26 Apr 2024 19:22:38 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto/message/63006 --btF4la24CZp93RgFnoPu Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable You might want to check the "useradd/usermod" options with the "useradd/use= rmod --help" command. If you want to add a password the flag would be "-p",= and this argument expects the password to be encrypted. You can generate t= his encrypted password with the command: " openssl passwd -1 ", for example. Now, I've just noticed that we are referring to the 'root' user, which alre= ady exists! In this case, you just need to change its password, and you can= use the 'usermod' command with the '-p' flag. Here are the two scenarios: # Case for adding a new user with password EXTRA_USERS_PARAMS : append =3D "\ useradd -m -s /bin /bash -p '' ; \ " # Case for adding a password to an existent user like root EXTRA_USERS_PARAMS : append =3D "\ usermod -p '' root; \ " Note. Remember to escape characters from the encrypted password. For exampl= e, if there are any dollars in your string, escape them with the backslash.= For instance: - '$7abc.$8' + '\$7abc.\$8' =E2=80=94Daniel --btF4la24CZp93RgFnoPu Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable

You might want to check the "useradd/usermod" options with the "useradd/= usermod --help" command. If you want to add a password the flag would be "-= p", and this argument expects the password to be encrypted. You can generat= e this encrypted password with the command: "

Now, I've just noticed that we are referring to the 'root' user, which a= lready exists! In this case, you just need to change its password, and you = can use the 'usermod' command with the '-p' flag. Here are the two scenario= s:

# Case for adding a new user with password
EXTRA_USERS_PARAMS:append =3D "\

useradd -m -s /bin/bash -p '<en= crypted password>' <new_user>; \
"

# Case for adding = a password to an existent user like root
EXTRA_USERS_PARAMS:append<= span style=3D"color: #ffffff;"> =3D<= /span> "\
usermod -p '<encrypted password>= ;' root; \
"
 
Note. Remember to escape characters fr= om the encrypted password. For example, if there are any dollars in your st= ring, escape them with the backslash. For instance:

- '$7abc.$8'=
+ '\$7abc.\$8'
 
—Daniel
--btF4la24CZp93RgFnoPu--