<?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: Need help - script for adding users in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-script-for-adding-users/m-p/2786461#M78574</link>
    <description>Ok I could use Restrictred Sam..that is a great idea.&lt;BR /&gt;Otherwise do you all agree that Case statements are better for something like this?  And if it is better, please explain to me why.&lt;BR /&gt;&lt;BR /&gt;Thanks..Angie</description>
    <pubDate>Thu, 15 Aug 2002 13:58:38 GMT</pubDate>
    <dc:creator>Angie_1</dc:creator>
    <dc:date>2002-08-15T13:58:38Z</dc:date>
    <item>
      <title>Need help - script for adding users</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-script-for-adding-users/m-p/2786454#M78567</link>
      <description>I need some help writing a script to add users.&lt;BR /&gt;I am very new to writing scripts and have read a bit on case statements and half way understand them.&lt;BR /&gt;So I would prefer it to be written with the case statement if that can be done.&lt;BR /&gt;Can someone please help me?&lt;BR /&gt;&lt;BR /&gt;Thx..Angie</description>
      <pubDate>Wed, 14 Aug 2002 22:57:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-script-for-adding-users/m-p/2786454#M78567</guid>
      <dc:creator>Angie_1</dc:creator>
      <dc:date>2002-08-14T22:57:44Z</dc:date>
    </item>
    <item>
      <title>Re: Need help - script for adding users</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-script-for-adding-users/m-p/2786455#M78568</link>
      <description>I wanted to add that if the "if" and "then" can be done I somewhat understand that too.  I am trying my best to learn but still need some help.&lt;BR /&gt;&lt;BR /&gt;Thx..Angie</description>
      <pubDate>Wed, 14 Aug 2002 23:04:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-script-for-adding-users/m-p/2786455#M78568</guid>
      <dc:creator>Angie_1</dc:creator>
      <dc:date>2002-08-14T23:04:38Z</dc:date>
    </item>
    <item>
      <title>Re: Need help - script for adding users</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-script-for-adding-users/m-p/2786456#M78569</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;You will need to input the information about the logins somehow. Let's say you have an input file in this format&lt;BR /&gt;&lt;BR /&gt;#cat user_input&lt;BR /&gt;&lt;BR /&gt;user1  - 5000  - User1, some info - 20 - /usr/bin/ksh&lt;BR /&gt;user2 - 5001 - User2, some info - 20 - /sbin/sh&lt;BR /&gt;user3 - 5002 - User3, some info - 20 - /sbin/csh &lt;BR /&gt;&lt;BR /&gt;You can write a  very simple script like this&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;&lt;BR /&gt;cat user_input |while read line                                         &lt;BR /&gt;do                                                                 &lt;BR /&gt;USER=$(echo $line|awk '{FS="-";print $1}')                         &lt;BR /&gt;UID=$(echo $line|awk '{FS="-";print $2}')                          &lt;BR /&gt;GECOS=$(echo $line|awk '{FS="-";print $3}')                        &lt;BR /&gt;GID=$(echo $line|awk '{FS="-";print $4}')                          &lt;BR /&gt;SHL=$(echo $line|awk '{FS="-";print $5}')                          &lt;BR /&gt;echo "Adding $USER"                                                &lt;BR /&gt;useradd -u $UID -g $GID -s $SHL -c "$GECOS" -m -k /etc/skel $USER  &lt;BR /&gt;passwd -df $USER&lt;BR /&gt;done            &lt;BR /&gt;&lt;BR /&gt;The above will force reset the passwords of the users so that when then login, it will prompt to chage their passwords.&lt;BR /&gt;&lt;BR /&gt;It is a security risk. You can generate a an encrypted password and enter it into passwd file. You can search in the forums and find the ways of doing it. There are quite a number of threads on it.&lt;BR /&gt;&lt;BR /&gt;I hope it can help you to start with.&lt;BR /&gt;-Sri                                                   &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 15 Aug 2002 01:12:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-script-for-adding-users/m-p/2786456#M78569</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2002-08-15T01:12:50Z</dc:date>
    </item>
    <item>
      <title>Re: Need help - script for adding users</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-script-for-adding-users/m-p/2786457#M78570</link>
      <description>I guess I should have explained a little bit better.&lt;BR /&gt;This will be given to the help desk, this script.  A new user will be setup by the helpdesk maybe once a week.  &lt;BR /&gt;&lt;BR /&gt;They need to then have a menu and choose from the menu the 'add user' or 'change user' or 'delete user'... options.&lt;BR /&gt;&lt;BR /&gt;Then they will input the information at the various prompts about who they are adding (for example).&lt;BR /&gt;It should ask too what group they will be in (sales, engineering) and if they are in one of those groups, then it should use the group ID assigned to that group (like 20 or 30 or whatever).&lt;BR /&gt;&lt;BR /&gt;I wonder if Case statements or If/then would work?  I know nothing about awk so I wanted to avoid that.  Please help...thx.Angie</description>
      <pubDate>Thu, 15 Aug 2002 13:41:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-script-for-adding-users/m-p/2786457#M78570</guid>
      <dc:creator>Angie_1</dc:creator>
      <dc:date>2002-08-15T13:41:17Z</dc:date>
    </item>
    <item>
      <title>Re: Need help - script for adding users</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-script-for-adding-users/m-p/2786458#M78571</link>
      <description>Hi Angie:&lt;BR /&gt;&lt;BR /&gt;As a general rule, 'case' statements are superior to 'if/else/if...' oscillations for three or more cases.&lt;BR /&gt;&lt;BR /&gt;The code is generally faster to execute, smaller, and perhaps most importantly, easier for the human to read and maintain.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 15 Aug 2002 13:45:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-script-for-adding-users/m-p/2786458#M78571</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2002-08-15T13:45:31Z</dc:date>
    </item>
    <item>
      <title>Re: Need help - script for adding users</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-script-for-adding-users/m-p/2786459#M78572</link>
      <description>If that's all you are doing then the better answer is to set up a restricted SAM session to allow your help-desk operators to add users under SAM. That is likely to be a better user interface than you are going to be able to do on your own.&lt;BR /&gt;&lt;BR /&gt;Man sam for details and note the "Restricted SAM" section.&lt;BR /&gt;</description>
      <pubDate>Thu, 15 Aug 2002 13:47:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-script-for-adding-users/m-p/2786459#M78572</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-08-15T13:47:53Z</dc:date>
    </item>
    <item>
      <title>Re: Need help - script for adding users</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-script-for-adding-users/m-p/2786460#M78573</link>
      <description>Have you thought about using restricted SAM. That way you could set up a login that went straight into a SAM session. This SAM session could be restricted to creating and manipulating users and groups.&lt;BR /&gt;&lt;BR /&gt;If you want to learn more about case and if statements try getting a copy of "Learning the Korn Shell" by O'Reilly.&lt;BR /&gt;&lt;BR /&gt;Chris&lt;BR /&gt;</description>
      <pubDate>Thu, 15 Aug 2002 13:52:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-script-for-adding-users/m-p/2786460#M78573</guid>
      <dc:creator>Chris Lonergan</dc:creator>
      <dc:date>2002-08-15T13:52:37Z</dc:date>
    </item>
    <item>
      <title>Re: Need help - script for adding users</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-script-for-adding-users/m-p/2786461#M78574</link>
      <description>Ok I could use Restrictred Sam..that is a great idea.&lt;BR /&gt;Otherwise do you all agree that Case statements are better for something like this?  And if it is better, please explain to me why.&lt;BR /&gt;&lt;BR /&gt;Thanks..Angie</description>
      <pubDate>Thu, 15 Aug 2002 13:58:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-script-for-adding-users/m-p/2786461#M78574</guid>
      <dc:creator>Angie_1</dc:creator>
      <dc:date>2002-08-15T13:58:38Z</dc:date>
    </item>
    <item>
      <title>Re: Need help - script for adding users</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-script-for-adding-users/m-p/2786462#M78575</link>
      <description>Better is a tougher question. The case MIGHT be less efficient but will almost always be much more readable. The problem with many if's is that they rapidly become clumsy. In general, if it's a simple if then else then if's are probably your best choice but if the branches are above 3 then the case is usually the better weapon.&lt;BR /&gt;&lt;BR /&gt;In almost all cases, readability is valued above pure efficiency.&lt;BR /&gt;</description>
      <pubDate>Thu, 15 Aug 2002 14:52:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-script-for-adding-users/m-p/2786462#M78575</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-08-15T14:52:30Z</dc:date>
    </item>
    <item>
      <title>Re: Need help - script for adding users</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-script-for-adding-users/m-p/2786463#M78576</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Restricted SAM is a great idea.&lt;BR /&gt;&lt;BR /&gt;I would not say "case" is the better statement than if-then-else as it is dependent on the function of the script, but it is the famous statement used in cases like this. If you are willing to write a script, then I would suggest that you write functions for each action and call them from the case statement. If there are a lot of cases, if-then-else can confuse you enough.&lt;BR /&gt;&lt;BR /&gt;-Sri</description>
      <pubDate>Thu, 15 Aug 2002 15:31:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-script-for-adding-users/m-p/2786463#M78576</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2002-08-15T15:31:24Z</dc:date>
    </item>
    <item>
      <title>Re: Need help - script for adding users</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-script-for-adding-users/m-p/2786464#M78577</link>
      <description>Hi Angie,&lt;BR /&gt;&lt;BR /&gt;I have to agree with all the Guru???s.  Restricted SAM is a great idea.  Also, one more great idea is you might want to assign some points to these guys.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;Mike&lt;BR /&gt;</description>
      <pubDate>Thu, 15 Aug 2002 16:36:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-script-for-adding-users/m-p/2786464#M78577</guid>
      <dc:creator>Mike_305</dc:creator>
      <dc:date>2002-08-15T16:36:17Z</dc:date>
    </item>
    <item>
      <title>Re: Need help - script for adding users</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-script-for-adding-users/m-p/2786465#M78578</link>
      <description>Restricted SAM is great if you only have HPUX to worry about. If you have other flavors of Unix to support, a generic script may be better.&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;Marty</description>
      <pubDate>Thu, 15 Aug 2002 16:40:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-script-for-adding-users/m-p/2786465#M78578</guid>
      <dc:creator>Martin Johnson</dc:creator>
      <dc:date>2002-08-15T16:40:38Z</dc:date>
    </item>
    <item>
      <title>Re: Need help - script for adding users</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-script-for-adding-users/m-p/2786466#M78579</link>
      <description>Thank you ALL so much!!  &lt;BR /&gt;I ended up being able to use the Restricted Sam (ran it by the boss) and set up a test account.  This really relieved the pressure!&lt;BR /&gt;&lt;BR /&gt;Angie</description>
      <pubDate>Thu, 15 Aug 2002 16:41:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-script-for-adding-users/m-p/2786466#M78579</guid>
      <dc:creator>Angie_1</dc:creator>
      <dc:date>2002-08-15T16:41:43Z</dc:date>
    </item>
  </channel>
</rss>

