<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Implement a user and password with sudo permission in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/Implement-a-user-and-password-with-sudo-permission/m-p/1878815#M224405</link>
    <description>&lt;P&gt;Hi,&lt;BR /&gt;I am using imx.8m.plus SOC using phytec SOM.&lt;BR /&gt;I need to add a user called newmachine with a password 1234rt&lt;BR /&gt;I need to have root login with a password&lt;BR /&gt;My user need to have sudo permission.&lt;BR /&gt;All these I need to do when I build the yocto image itself.&lt;BR /&gt;I tried several ways, but not sure what I am doing wrong.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Steps which I have followed :&lt;BR /&gt;I created my own machine .bb file, its working fine.&lt;BR /&gt;Then into that file I added,&lt;BR /&gt;below code,&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;inherit&lt;/SPAN&gt; &lt;SPAN class=""&gt;extrausers&lt;/SPAN&gt;
&lt;SPAN class=""&gt;EXTRA_USERS_PARAMS&lt;/SPAN&gt; &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;"&lt;/SPAN&gt;&lt;SPAN class=""&gt;\&lt;/SPAN&gt;
&lt;SPAN class=""&gt;    useradd -p '' newmachine ; "&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;Here without the password, I am able to access my device through ssh, via ethenet.&lt;BR /&gt;When I add password directly ( hardcoded ) or using mkpasswd - &amp;gt; like below, I am not able to access my device over ssh.&lt;/P&gt;&lt;PRE&gt;printf "%q" $(mkpasswd -m sha256crypt 1234rt)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;then final code looks like:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;inherit&lt;/SPAN&gt; &lt;SPAN class=""&gt;extrausers&lt;/SPAN&gt;
&lt;SPAN class=""&gt;PASSWD&lt;/SPAN&gt; &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;"\$5\$cAO0AZTEak0DE4Z9\$joF9Clj2kEG4XlRJbL5udiqX2yYL3ib9jXKsAsRngPD"&lt;/SPAN&gt;
&lt;SPAN class=""&gt;EXTRA_USERS_PARAMS&lt;/SPAN&gt; &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;"&lt;/SPAN&gt;&lt;SPAN class=""&gt;\&lt;/SPAN&gt;
&lt;SPAN class=""&gt;    useradd -p '$&lt;/SPAN&gt;&lt;SPAN class=""&gt;{PASSWD}&lt;/SPAN&gt;&lt;SPAN class=""&gt;' newmachine ; &lt;/SPAN&gt;&lt;SPAN class=""&gt;\&lt;/SPAN&gt;
&lt;SPAN class=""&gt;    "&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;For changing root password, I tried as :&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;inherit&lt;/SPAN&gt; &lt;SPAN class=""&gt;extrausers&lt;/SPAN&gt;
&lt;SPAN class=""&gt;EXTRA_USERS_PARAMS&lt;/SPAN&gt; &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;"&lt;/SPAN&gt;&lt;SPAN class=""&gt;\&lt;/SPAN&gt;
&lt;SPAN class=""&gt;    usermod -p '$&lt;/SPAN&gt;&lt;SPAN class=""&gt;{PASSWD}&lt;/SPAN&gt;&lt;SPAN class=""&gt;' root; &lt;/SPAN&gt;&lt;SPAN class=""&gt;\&lt;/SPAN&gt;
&lt;SPAN class=""&gt;    "&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I really don't know what is wrong here, I tried multiple experiments, and nothing was successful.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;For adding sudo permission for my user, I added the following:&lt;/P&gt;&lt;PRE&gt;EXTRA_USERS_PARAMS = "echo '&lt;SPAN class=""&gt;newmachine &lt;/SPAN&gt;ALL=(ALL) NOPASSWD: ALL' &amp;gt; /etc/sudoers.d/&lt;SPAN class=""&gt;newmachine &lt;/SPAN&gt;"&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;here the newmachine file does not exist, that is something I would like to note it down, so I even tried to add it in&amp;nbsp;/etc/sudoers file, instead of echo to&amp;nbsp;sudoers.d, like below&lt;BR /&gt;&lt;BR /&gt;EXTRA_USERS_PARAMS = "echo '&lt;SPAN class=""&gt;newmachine&amp;nbsp;&lt;/SPAN&gt;ALL=(ALL) NOPASSWD: ALL' &amp;gt; /etc/sudoers&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;"&lt;BR /&gt;&lt;BR /&gt;None of the above is working, please let me know, what am I missing.&lt;/P&gt;</description>
    <pubDate>Fri, 31 May 2024 10:26:56 GMT</pubDate>
    <dc:creator>Rabiraj</dc:creator>
    <dc:date>2024-05-31T10:26:56Z</dc:date>
    <item>
      <title>Implement a user and password with sudo permission</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Implement-a-user-and-password-with-sudo-permission/m-p/1878815#M224405</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;I am using imx.8m.plus SOC using phytec SOM.&lt;BR /&gt;I need to add a user called newmachine with a password 1234rt&lt;BR /&gt;I need to have root login with a password&lt;BR /&gt;My user need to have sudo permission.&lt;BR /&gt;All these I need to do when I build the yocto image itself.&lt;BR /&gt;I tried several ways, but not sure what I am doing wrong.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Steps which I have followed :&lt;BR /&gt;I created my own machine .bb file, its working fine.&lt;BR /&gt;Then into that file I added,&lt;BR /&gt;below code,&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;inherit&lt;/SPAN&gt; &lt;SPAN class=""&gt;extrausers&lt;/SPAN&gt;
&lt;SPAN class=""&gt;EXTRA_USERS_PARAMS&lt;/SPAN&gt; &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;"&lt;/SPAN&gt;&lt;SPAN class=""&gt;\&lt;/SPAN&gt;
&lt;SPAN class=""&gt;    useradd -p '' newmachine ; "&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;Here without the password, I am able to access my device through ssh, via ethenet.&lt;BR /&gt;When I add password directly ( hardcoded ) or using mkpasswd - &amp;gt; like below, I am not able to access my device over ssh.&lt;/P&gt;&lt;PRE&gt;printf "%q" $(mkpasswd -m sha256crypt 1234rt)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;then final code looks like:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;inherit&lt;/SPAN&gt; &lt;SPAN class=""&gt;extrausers&lt;/SPAN&gt;
&lt;SPAN class=""&gt;PASSWD&lt;/SPAN&gt; &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;"\$5\$cAO0AZTEak0DE4Z9\$joF9Clj2kEG4XlRJbL5udiqX2yYL3ib9jXKsAsRngPD"&lt;/SPAN&gt;
&lt;SPAN class=""&gt;EXTRA_USERS_PARAMS&lt;/SPAN&gt; &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;"&lt;/SPAN&gt;&lt;SPAN class=""&gt;\&lt;/SPAN&gt;
&lt;SPAN class=""&gt;    useradd -p '$&lt;/SPAN&gt;&lt;SPAN class=""&gt;{PASSWD}&lt;/SPAN&gt;&lt;SPAN class=""&gt;' newmachine ; &lt;/SPAN&gt;&lt;SPAN class=""&gt;\&lt;/SPAN&gt;
&lt;SPAN class=""&gt;    "&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;For changing root password, I tried as :&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;inherit&lt;/SPAN&gt; &lt;SPAN class=""&gt;extrausers&lt;/SPAN&gt;
&lt;SPAN class=""&gt;EXTRA_USERS_PARAMS&lt;/SPAN&gt; &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;"&lt;/SPAN&gt;&lt;SPAN class=""&gt;\&lt;/SPAN&gt;
&lt;SPAN class=""&gt;    usermod -p '$&lt;/SPAN&gt;&lt;SPAN class=""&gt;{PASSWD}&lt;/SPAN&gt;&lt;SPAN class=""&gt;' root; &lt;/SPAN&gt;&lt;SPAN class=""&gt;\&lt;/SPAN&gt;
&lt;SPAN class=""&gt;    "&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I really don't know what is wrong here, I tried multiple experiments, and nothing was successful.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;For adding sudo permission for my user, I added the following:&lt;/P&gt;&lt;PRE&gt;EXTRA_USERS_PARAMS = "echo '&lt;SPAN class=""&gt;newmachine &lt;/SPAN&gt;ALL=(ALL) NOPASSWD: ALL' &amp;gt; /etc/sudoers.d/&lt;SPAN class=""&gt;newmachine &lt;/SPAN&gt;"&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;here the newmachine file does not exist, that is something I would like to note it down, so I even tried to add it in&amp;nbsp;/etc/sudoers file, instead of echo to&amp;nbsp;sudoers.d, like below&lt;BR /&gt;&lt;BR /&gt;EXTRA_USERS_PARAMS = "echo '&lt;SPAN class=""&gt;newmachine&amp;nbsp;&lt;/SPAN&gt;ALL=(ALL) NOPASSWD: ALL' &amp;gt; /etc/sudoers&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;"&lt;BR /&gt;&lt;BR /&gt;None of the above is working, please let me know, what am I missing.&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2024 10:26:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Implement-a-user-and-password-with-sudo-permission/m-p/1878815#M224405</guid>
      <dc:creator>Rabiraj</dc:creator>
      <dc:date>2024-05-31T10:26:56Z</dc:date>
    </item>
  </channel>
</rss>

