FAQ:How do I set or change the root password: Difference between revisions
From Yocto Project
Jump to navigationJump to search
PaulEggleton (talk | contribs) (Add warning) |
PaulEggleton (talk | contribs) (Add note about INHERIT +=.) |
||
Line 1: | Line 1: | ||
'''Q:''' How do I set / change the root password? | '''Q:''' How do I set / change the root password? | ||
'''A:''' Use the extrausers class to set the password: | '''A:''' Use the extrausers class to set the password. In your image recipe: | ||
inherit extrausers | inherit extrausers | ||
EXTRA_USERS_PARAMS = "usermod -P 1876*18 root;" | EXTRA_USERS_PARAMS = "usermod -P 1876*18 root;" | ||
This sets the root password to "1876*18". | This sets the root password to "1876*18". If you prefer to do this in local.conf or your distro configuration, you'll need to change the first line to <code>INHERIT += "extrausers"</code>. | ||
{| style="color:black; background-color:#ffcccc" width="100%" cellpadding="10" class="wikitable" | {| style="color:black; background-color:#ffcccc" width="100%" cellpadding="10" class="wikitable" | ||
Line 20: | Line 20: | ||
EXTRA_USERS_PARAMS = "useradd -P 2015*08 myUser;" | EXTRA_USERS_PARAMS = "useradd -P 2015*08 myUser;" | ||
This adds the user myUser and sets the password to "2015*08". | This adds the user myUser and sets the password to "2015*08". As above, if you prefer to do this in local.conf or your distro configuration, you'll need to change the first line to <code>INHERIT += "extrausers"</code>. | ||
Revision as of 02:47, 21 February 2018
Q: How do I set / change the root password?
A: Use the extrausers class to set the password. In your image recipe:
inherit extrausers EXTRA_USERS_PARAMS = "usermod -P 1876*18 root;"
This sets the root password to "1876*18". If you prefer to do this in local.conf or your distro configuration, you'll need to change the first line to INHERIT += "extrausers"
.
WARNING: if you are hardcoding a root password for a production image deployed to multiple devices, consider carefully the ramifications of doing so before proceeding. |
Q: How do I add users?
A: Use the extrausers class to and the user and set the password:
inherit extrausers EXTRA_USERS_PARAMS = "useradd -P 2015*08 myUser;"
This adds the user myUser and sets the password to "2015*08". As above, if you prefer to do this in local.conf or your distro configuration, you'll need to change the first line to INHERIT += "extrausers"
.