<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.yoctoproject.org/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Niall+Parker</id>
	<title>Yocto Project - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.yoctoproject.org/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Niall+Parker"/>
	<link rel="alternate" type="text/html" href="https://wiki.yoctoproject.org/wiki/Special:Contributions/Niall_Parker"/>
	<updated>2026-04-07T05:20:54Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.5</generator>
	<entry>
		<id>https://wiki.yoctoproject.org/wiki/index.php?title=FAQ:How_do_I_set_or_change_the_root_password&amp;diff=85161</id>
		<title>FAQ:How do I set or change the root password</title>
		<link rel="alternate" type="text/html" href="https://wiki.yoctoproject.org/wiki/index.php?title=FAQ:How_do_I_set_or_change_the_root_password&amp;diff=85161"/>
		<updated>2022-02-18T17:08:51Z</updated>

		<summary type="html">&lt;p&gt;Niall Parker: Include note and example for escaping the $ characters to preserve pwd hash in generated files.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Q:&#039;&#039;&#039; How do I set / change the root password?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Use the extrausers class to set the password. In your image recipe:&lt;br /&gt;
&lt;br /&gt;
 inherit extrausers&lt;br /&gt;
 EXTRA_USERS_PARAMS = &amp;quot;usermod -p &#039;\$5\$sIhB3FmJb4oSx.uN\$WWE8AJP8ybR03TXBJ2JMZJ6LpsrvcwKmsHxxY.asDR6&#039; root;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This sets the root password to a hashed value of &amp;quot;1876*18&amp;quot;. If you prefer to do this in local.conf or your distro configuration, you&#039;ll need to change the first line to &amp;lt;code&amp;gt;INHERIT += &amp;quot;extrausers&amp;quot;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To obtain the hashed value for a password, you can use the following command:&lt;br /&gt;
 &lt;br /&gt;
 $ python -c &#039;import crypt; print(crypt.crypt(&amp;quot;1876*18&amp;quot;, crypt.METHOD_SHA256))&#039;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#ffcccc&amp;quot; width=&amp;quot;100%&amp;quot; cellpadding=&amp;quot;10&amp;quot; class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|&#039;&#039;&#039;WARNING:&#039;&#039;&#039; if you are hardcoding a root password for a production image deployed to multiple devices, consider carefully the ramifications of doing so before proceeding.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note some characters may need some level of escaping to make it correctly into &amp;lt;code&amp;gt;/etc/shadow&amp;lt;/code&amp;gt; (examples shown should work)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; How do I add users?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Use the extrausers class to and the user and set the password. In your image recipe:&lt;br /&gt;
&lt;br /&gt;
 inherit extrausers&lt;br /&gt;
 EXTRA_USERS_PARAMS = &amp;quot;useradd -p &#039;\$5\$vn9du4U3jghFZaqC\$Fl6pQZK5FUoT2D6Twij3OpjGR9FXFsE1r/vyMtGooX6&#039; myUser;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This adds the user myUser and sets the password to a hashed value of &amp;quot;2015*08&amp;quot;. As above, if you prefer to do this in local.conf or your distro configuration, you&#039;ll need to change the first line to &amp;lt;code&amp;gt;INHERIT += &amp;quot;extrausers&amp;quot;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:FAQ]] [[Category:FAQ-open]]&lt;/div&gt;</summary>
		<author><name>Niall Parker</name></author>
	</entry>
</feed>