FAQ:How do I set or change the root password: Difference between revisions

From Yocto Project
Jump to navigationJump to search
(change the root password)
(Point to (maintained) documentation. ($ needs to be escaped and it was not explained here but in the docs))
 
(9 intermediate revisions by 7 users not shown)
Line 1: Line 1:
'''Q:''' How do I set / change the root password?
The content of this document has been moved to: https://docs.yoctoproject.org/ref-manual/classes.html#extrausers-bbclass


'''A:''' In the image.bb file (eg: core-image-minimal.bb), append this text:
ROOTFS_POSTPROCESS_COMMAND += "\
    sed 's%^root:[^:]*:%root:wYNffsf6sozwE:%' \
        < ${IMAGE_ROOTFS}/etc/shadow \
        > ${IMAGE_ROOTFS}/etc/shadow.new;\
    mv ${IMAGE_ROOTFS}/etc/shadow.new ${IMAGE_ROOTFS}/etc/shadow ;"
This will set the root password as "root" in the newly built image.
To choose a different password, use the command:
"passwd root"
and copy the corresponding part of "/etc/shadow" to this text:
eg:
# cat /etc/shadow
root:wYNffsf6sozwE:16122:0:99999:7:::
...
[[Category:FAQ]] [[Category:FAQ-open]]
[[Category:FAQ]] [[Category:FAQ-open]]

Latest revision as of 17:10, 18 February 2022

The content of this document has been moved to: https://docs.yoctoproject.org/ref-manual/classes.html#extrausers-bbclass