Openembedded Core Discussions
 help / color / mirror / Atom feed
From: ChenQi <Qi.Chen@windriver.com>
To: <openembedded-core@lists.openembedded.org>
Subject: Re: Setting root password
Date: Sat, 12 Oct 2013 10:04:23 +0800	[thread overview]
Message-ID: <5258AE27.3070504@windriver.com> (raw)
In-Reply-To: <52580CC0.10808@communistcode.co.uk>

On 10/11/2013 10:35 PM, Jack Mitchell wrote:
> What is the best way to set the root password for an image during build
> time?
>
> I have come across this snippet:
>
> ROOTFS_POSTPROCESS_COMMAND += " \
>          sed 's%^root:[^:]*:%root:${PASSWD}:%' \
>          < ${IMAGE_ROOTFS}/etc/shadow \
>          > ${IMAGE_ROOTFS}/etc/shadow.new;\
>          mv ${IMAGE_ROOTFS}/etc/shadow.new ${IMAGE_ROOTFS}/etc/shadow ;"
>
> but it feels a bit hacky... is there no defined way to do this cleanly?
>
> Cheers,
> Jack.
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>
>
What about using EXTRA_USERS_PARAMS?

E.g.
1. Get the encrypted password.
(One way to get the encrypted password is using openssl, of course you 
can use other methods.)
openssl passwd -1 root
$1$QauDU/Ig$KEeg.OaCLFkNwSXW4xYRu1


2. Add to local.conf the following lines. Note the '$' sign should be 
escaped.

INHERIT += "extrausers"
EXTRA_USERS_PARAMS = "usermod -p '\$1\$QauDU/Ig\$KEeg.OaCLFkNwSXW4xYRu1' root;"


Best Regards,
Chen Qi


      parent reply	other threads:[~2013-10-12  2:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-11 14:35 Setting root password Jack Mitchell
2013-10-11 15:08 ` Koen Kooi
2013-10-12  2:04 ` ChenQi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5258AE27.3070504@windriver.com \
    --to=qi.chen@windriver.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox