<?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 Re: Script to update password field in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-update-password-field/m-p/2565250#M919587</link>
    <description>Oops&lt;BR /&gt;&lt;BR /&gt;that should be&lt;BR /&gt;&lt;BR /&gt;sed "s#$pass#abCdef#" /etc/passwd &amp;gt; /etc/passwd.new &lt;BR /&gt;&lt;BR /&gt;Obviously you do want to generate the new file right. ;)&lt;BR /&gt;&lt;BR /&gt;-Regards&lt;BR /&gt;I am RU</description>
    <pubDate>Wed, 15 Aug 2001 14:35:16 GMT</pubDate>
    <dc:creator>linuxfan</dc:creator>
    <dc:date>2001-08-15T14:35:16Z</dc:date>
    <item>
      <title>Script to update password field</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-update-password-field/m-p/2565244#M919581</link>
      <description>I have a file e.g idlist.txt which contains a list of login-names.&lt;BR /&gt;&lt;BR /&gt;I would like to read idlist.txt and update the password field in /etc/passwd to a FIXED string e.g "abCdef".&lt;BR /&gt;&lt;BR /&gt;Anybody knows how to do it ?&lt;BR /&gt;&lt;BR /&gt;NOTE : &lt;BR /&gt;* The password field may contain "/" and "\". The script should be able to handle it. This is what stucks me.&lt;BR /&gt;</description>
      <pubDate>Tue, 14 Aug 2001 14:06:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-update-password-field/m-p/2565244#M919581</guid>
      <dc:creator>Kong Kian Chay</dc:creator>
      <dc:date>2001-08-14T14:06:43Z</dc:date>
    </item>
    <item>
      <title>Re: Script to update password field</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-update-password-field/m-p/2565245#M919582</link>
      <description>I really do not know why you would want to do that?????  The password field in /etc/passwd is encrypted.  If you change it to abCdef, the user will not be able to log in.  Why not just lock the accounts or remove the user??? &lt;BR /&gt;&lt;BR /&gt;But anyway, this is a way to do what you said you wanted???&lt;BR /&gt;&lt;BR /&gt;for x in `cat idlist.txt'&lt;BR /&gt;do&lt;BR /&gt;var1=`cat /etc/passwd | grep ${x} | cut -f2 -d":"`&lt;BR /&gt;sed 's/${var1}/abCdef/' &amp;gt; /etc/passwd.out&lt;BR /&gt;mv /etc/passwd.out /etc/passwd&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;I would not do it though!!!!!!!&lt;BR /&gt;&lt;BR /&gt;...jcd...</description>
      <pubDate>Tue, 14 Aug 2001 14:28:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-update-password-field/m-p/2565245#M919582</guid>
      <dc:creator>Joseph C. Denman</dc:creator>
      <dc:date>2001-08-14T14:28:03Z</dc:date>
    </item>
    <item>
      <title>Re: Script to update password field</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-update-password-field/m-p/2565246#M919583</link>
      <description>Hi&lt;BR /&gt;  If you really want to replace the passwd field with a fixed text you can do&lt;BR /&gt;&lt;BR /&gt;awk -F: '{ print $1":""text"":"$3":"$4":"$5":"$6":"$7 }' /etc/passwd &amp;gt; /etc/passwd.tmp&lt;BR /&gt;&lt;BR /&gt;All the best &lt;BR /&gt;&lt;BR /&gt;..BPK...&lt;BR /&gt;</description>
      <pubDate>Tue, 14 Aug 2001 14:35:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-update-password-field/m-p/2565246#M919583</guid>
      <dc:creator>Praveen Bezawada</dc:creator>
      <dc:date>2001-08-14T14:35:04Z</dc:date>
    </item>
    <item>
      <title>Re: Script to update password field</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-update-password-field/m-p/2565247#M919584</link>
      <description>Hi Kong,&lt;BR /&gt;&lt;BR /&gt;Before you try anthing make sure you keep a copy of you password file and have another terminal session open.&lt;BR /&gt;&lt;BR /&gt;Now you could use something like this,&lt;BR /&gt;&lt;BR /&gt;for id in `cat idlist.txt`&lt;BR /&gt;do&lt;BR /&gt;  pass=`pwget -n id | cut -f2 -d":"`&lt;BR /&gt;  sed "s/$pass/abCdef/" /etc/passwd &amp;gt; /etc/passwd.new&lt;BR /&gt;done&lt;BR /&gt; &lt;BR /&gt;The reason i did use grep is because it won't work if you have users called test1 test12 etc.&lt;BR /&gt;&lt;BR /&gt;Once you have verified the new /etc/passwd.new&lt;BR /&gt;move it to the /etc/directory.&lt;BR /&gt;make sure the permissions are ok.&lt;BR /&gt;&lt;BR /&gt;-HTH&lt;BR /&gt;I am RU&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 14 Aug 2001 15:06:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-update-password-field/m-p/2565247#M919584</guid>
      <dc:creator>linuxfan</dc:creator>
      <dc:date>2001-08-14T15:06:25Z</dc:date>
    </item>
    <item>
      <title>Re: Script to update password field</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-update-password-field/m-p/2565248#M919585</link>
      <description>Joseph &amp;amp; Ramesh&lt;BR /&gt;&lt;BR /&gt;  The "sed" command will FAIL when the password field contains special char like "/".&lt;BR /&gt;&lt;BR /&gt;  However, the "awk" command is perfect.&lt;BR /&gt;</description>
      <pubDate>Wed, 15 Aug 2001 14:15:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-update-password-field/m-p/2565248#M919585</guid>
      <dc:creator>Kong Kian Chay</dc:creator>
      <dc:date>2001-08-15T14:15:52Z</dc:date>
    </item>
    <item>
      <title>Re: Script to update password field</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-update-password-field/m-p/2565249#M919586</link>
      <description>Hi Kong, &lt;BR /&gt;&lt;BR /&gt;change the sed line to the following&lt;BR /&gt;&lt;BR /&gt;sed "s#$pass#abCdef#" /etc/passwd /etc/passwd.new&lt;BR /&gt;&lt;BR /&gt;This should work&lt;BR /&gt;&lt;BR /&gt;-HTH&lt;BR /&gt;I am RU</description>
      <pubDate>Wed, 15 Aug 2001 14:33:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-update-password-field/m-p/2565249#M919586</guid>
      <dc:creator>linuxfan</dc:creator>
      <dc:date>2001-08-15T14:33:36Z</dc:date>
    </item>
    <item>
      <title>Re: Script to update password field</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-update-password-field/m-p/2565250#M919587</link>
      <description>Oops&lt;BR /&gt;&lt;BR /&gt;that should be&lt;BR /&gt;&lt;BR /&gt;sed "s#$pass#abCdef#" /etc/passwd &amp;gt; /etc/passwd.new &lt;BR /&gt;&lt;BR /&gt;Obviously you do want to generate the new file right. ;)&lt;BR /&gt;&lt;BR /&gt;-Regards&lt;BR /&gt;I am RU</description>
      <pubDate>Wed, 15 Aug 2001 14:35:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-update-password-field/m-p/2565250#M919587</guid>
      <dc:creator>linuxfan</dc:creator>
      <dc:date>2001-08-15T14:35:16Z</dc:date>
    </item>
  </channel>
</rss>

