<?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 Adding Multiple Users using a script on a Trusted System in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/adding-multiple-users-using-a-script-on-a-trusted-system/m-p/4891284#M705308</link>
    <description>Hi Experts,&lt;BR /&gt;&lt;BR /&gt;I have got multiple hpus servers on those I need to create nearly 20 new users. Being this is a big talk I would like to use a script for this.&lt;BR /&gt;&lt;BR /&gt;I have the following text files from where I need the inputs to be taken for the user creation. the files are.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;logid  ( this is the required login ID  )&lt;BR /&gt;username ( This is the user description required.This is in the format of "Firstname LastName" )&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I understand the useradd command will take a unique ID and since i am not using an input file for the same.&lt;BR /&gt;&lt;BR /&gt;I started writing the script as follwos. Dont laugh at me..Im very bad in scripting.Sorry....&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;#This script will add users taking input from the files logid &amp;amp; username present in the current directory.&lt;BR /&gt;clear&lt;BR /&gt;echo "\n\n\n"&lt;BR /&gt;&lt;BR /&gt;#groupadd dbuser&lt;BR /&gt;&lt;BR /&gt;  for logid in `cat ./logid`&lt;BR /&gt;&lt;BR /&gt;do&lt;BR /&gt;    for username in `cat ./username`&lt;BR /&gt;do&lt;BR /&gt;&lt;BR /&gt;#useradd -c "$username" -g dbuser -m -s /usr/bin/ksh -k /etc/skel -d /home/$logid db$logid&lt;BR /&gt;echo "Created user $username\n"&lt;BR /&gt;&lt;BR /&gt;done&lt;BR /&gt;  done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I hashed the groupadd and useradd commands before actually executing the same. I understand that my looping is not proper.&lt;BR /&gt;&lt;BR /&gt;Can anyone correct my script or recommand a better &amp;amp; easier  method to achieve my goal.&lt;BR /&gt;&lt;BR /&gt;Thanks a million in advance.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Syam&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Wed, 16 Mar 2005 03:10:35 GMT</pubDate>
    <dc:creator>Ranjith_5</dc:creator>
    <dc:date>2005-03-16T03:10:35Z</dc:date>
    <item>
      <title>Adding Multiple Users using a script on a Trusted System</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/adding-multiple-users-using-a-script-on-a-trusted-system/m-p/4891284#M705308</link>
      <description>Hi Experts,&lt;BR /&gt;&lt;BR /&gt;I have got multiple hpus servers on those I need to create nearly 20 new users. Being this is a big talk I would like to use a script for this.&lt;BR /&gt;&lt;BR /&gt;I have the following text files from where I need the inputs to be taken for the user creation. the files are.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;logid  ( this is the required login ID  )&lt;BR /&gt;username ( This is the user description required.This is in the format of "Firstname LastName" )&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I understand the useradd command will take a unique ID and since i am not using an input file for the same.&lt;BR /&gt;&lt;BR /&gt;I started writing the script as follwos. Dont laugh at me..Im very bad in scripting.Sorry....&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;#This script will add users taking input from the files logid &amp;amp; username present in the current directory.&lt;BR /&gt;clear&lt;BR /&gt;echo "\n\n\n"&lt;BR /&gt;&lt;BR /&gt;#groupadd dbuser&lt;BR /&gt;&lt;BR /&gt;  for logid in `cat ./logid`&lt;BR /&gt;&lt;BR /&gt;do&lt;BR /&gt;    for username in `cat ./username`&lt;BR /&gt;do&lt;BR /&gt;&lt;BR /&gt;#useradd -c "$username" -g dbuser -m -s /usr/bin/ksh -k /etc/skel -d /home/$logid db$logid&lt;BR /&gt;echo "Created user $username\n"&lt;BR /&gt;&lt;BR /&gt;done&lt;BR /&gt;  done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I hashed the groupadd and useradd commands before actually executing the same. I understand that my looping is not proper.&lt;BR /&gt;&lt;BR /&gt;Can anyone correct my script or recommand a better &amp;amp; easier  method to achieve my goal.&lt;BR /&gt;&lt;BR /&gt;Thanks a million in advance.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Syam&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 16 Mar 2005 03:10:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/adding-multiple-users-using-a-script-on-a-trusted-system/m-p/4891284#M705308</guid>
      <dc:creator>Ranjith_5</dc:creator>
      <dc:date>2005-03-16T03:10:35Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Multiple Users using a script on a Trusted System</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/adding-multiple-users-using-a-script-on-a-trusted-system/m-p/4891285#M705309</link>
      <description>Syam,&lt;BR /&gt;I would first combine the logid and username file into format:&lt;BR /&gt;logid FirstName LastName&lt;BR /&gt;&lt;BR /&gt;then &lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;#groupadd dbuser&lt;BR /&gt;#read all the data in the file user.dat&lt;BR /&gt;while read data&lt;BR /&gt;do&lt;BR /&gt;#split the fields up&lt;BR /&gt;#first field&lt;BR /&gt;logid=`echo $data  | cut -d' ' -f1`&lt;BR /&gt;#second field onwards&lt;BR /&gt;username=`echo $data  | cut -d' ' -f2-`&lt;BR /&gt;&lt;BR /&gt;#useradd -c "$username" -g dbuser -m -s /usr/bin/ksh -k /etc/skel -d /home/$logid db$logid&lt;BR /&gt;echo "Created user $username"&lt;BR /&gt;done &amp;lt; user.dat&lt;BR /&gt;&lt;BR /&gt;Regards</description>
      <pubDate>Wed, 16 Mar 2005 03:40:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/adding-multiple-users-using-a-script-on-a-trusted-system/m-p/4891285#M705309</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2005-03-16T03:40:57Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Multiple Users using a script on a Trusted System</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/adding-multiple-users-using-a-script-on-a-trusted-system/m-p/4891286#M705310</link>
      <description>Hi ,&lt;BR /&gt;&lt;BR /&gt;Thanks a lot...But will this work on trusted system? The passwords are stored in TCB database.&lt;BR /&gt;&lt;BR /&gt;Also I wanted the passwords also to be changed with this to a specified one Else.&lt;BR /&gt;&lt;BR /&gt;Else this script wont do the purpose since I have to go to every machine to change the passwords.&lt;BR /&gt;&lt;BR /&gt;Thanks once again.&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;Syam</description>
      <pubDate>Wed, 16 Mar 2005 04:06:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/adding-multiple-users-using-a-script-on-a-trusted-system/m-p/4891286#M705310</guid>
      <dc:creator>Ranjith_5</dc:creator>
      <dc:date>2005-03-16T04:06:27Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Multiple Users using a script on a Trusted System</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/adding-multiple-users-using-a-script-on-a-trusted-system/m-p/4891287#M705311</link>
      <description>Syam,&lt;BR /&gt;the second part of the question is a bit more tricky (I think).&lt;BR /&gt;According to man useradd:&lt;BR /&gt;"If the system is in trusted mode, useradd returns a random password to stdout: the new login is still locked until the passwd command is invoked."&lt;BR /&gt;So the problem is to change the password, which I think would be best done using expect.This will then allow you to chnage the password and unlock the account at the same time.&lt;BR /&gt;Regards</description>
      <pubDate>Wed, 16 Mar 2005 04:17:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/adding-multiple-users-using-a-script-on-a-trusted-system/m-p/4891287#M705311</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2005-03-16T04:17:02Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Multiple Users using a script on a Trusted System</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/adding-multiple-users-using-a-script-on-a-trusted-system/m-p/4891288#M705312</link>
      <description>Hi..,&lt;BR /&gt;&lt;BR /&gt;Can Anyone again explain me how to overcome the problem of changing password using the script on the trusted system.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Syam</description>
      <pubDate>Wed, 16 Mar 2005 06:38:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/adding-multiple-users-using-a-script-on-a-trusted-system/m-p/4891288#M705312</guid>
      <dc:creator>Ranjith_5</dc:creator>
      <dc:date>2005-03-16T06:38:16Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Multiple Users using a script on a Trusted System</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/adding-multiple-users-using-a-script-on-a-trusted-system/m-p/4891289#M705313</link>
      <description>Hi ,&lt;BR /&gt;&lt;BR /&gt;I modified my script again as follows and it is now able to server my purpose. Thanks for all.&lt;BR /&gt;&lt;BR /&gt;############################################################&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;groupadd dbuser&lt;BR /&gt;rm -f passwords.dat&lt;BR /&gt;#read all the data in the file user.dat&lt;BR /&gt;while read data&lt;BR /&gt;do&lt;BR /&gt;#split the fields up&lt;BR /&gt;#first field&lt;BR /&gt;logid=`echo $data | cut -d' ' -f1`&lt;BR /&gt;#second field onwards&lt;BR /&gt;username=`echo $data | cut -d' ' -f2-`&lt;BR /&gt;&lt;BR /&gt;useradd -c "$username" -g dbuser -m -s /usr/bin/ksh -k /etc/skel -d /home/db$logid db$logid&lt;BR /&gt;/usr/lbin/modprpw -x db$logid &amp;gt;&amp;gt; passwords.dat&lt;BR /&gt;echo "Created user $username"&lt;BR /&gt;done &amp;lt; user.dat&lt;BR /&gt;cat passwords.dat|cut -f2 -d"="&amp;gt;passwords.txt&lt;BR /&gt;rm -f passwords.dat&lt;BR /&gt;&lt;BR /&gt;########################################################&lt;BR /&gt;&lt;BR /&gt;The above script stored the initial passwords in a txt file called passwords.txt. I only need to do cat passwords.txt and copy paste to excel. &lt;BR /&gt;My Problem is solved.&lt;BR /&gt;&lt;BR /&gt;Closing this thread. Thanks all who replied.&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;Syam</description>
      <pubDate>Sun, 20 Mar 2005 02:12:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/adding-multiple-users-using-a-script-on-a-trusted-system/m-p/4891289#M705313</guid>
      <dc:creator>Ranjith_5</dc:creator>
      <dc:date>2005-03-20T02:12:18Z</dc:date>
    </item>
  </channel>
</rss>

