<?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: useradd script question in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/useradd-script-question/m-p/4548116#M370293</link>
    <description>Hi James,&lt;BR /&gt;I got one more question,&lt;BR /&gt;&lt;BR /&gt;I am using the same script to reset the passwd and instead of useradd command I use:&lt;BR /&gt;&lt;BR /&gt;ssh -t $i -n passwd $uid inside the while loop, but it does not work, giving me the error:&lt;BR /&gt;Pseudo-terminal will not be allocated because stdin is not a terminal.&lt;BR /&gt;Changing password for user3&lt;BR /&gt;pam_chauthtok: System error&lt;BR /&gt;&lt;BR /&gt;Is there any way it can be fixed, and is there any way some how to input the hardcoded passwd ?&lt;BR /&gt;</description>
    <pubDate>Fri, 11 Dec 2009 00:38:04 GMT</pubDate>
    <dc:creator>emp001</dc:creator>
    <dc:date>2009-12-11T00:38:04Z</dc:date>
    <item>
      <title>useradd script question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/useradd-script-question/m-p/4548111#M370288</link>
      <description>I have the issue, I put the ssh command into the script ( I have 2 hosts in the hosts file and 3 users – user1, user2 , user3 in the user_list) :&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;If I use ssh command in the script it uses only user1:&lt;BR /&gt;&lt;BR /&gt;for i in `cat hosts`&lt;BR /&gt;&lt;BR /&gt;do&lt;BR /&gt;&lt;BR /&gt;echo "Adding users on $i"&lt;BR /&gt;&lt;BR /&gt;cat user_list | while read uid comment&lt;BR /&gt;&lt;BR /&gt;do&lt;BR /&gt;&lt;BR /&gt;echo "Adding user $uid on host $i"&lt;BR /&gt;&lt;BR /&gt;ssh -q $i useradd -c \"$comment\" -g users -d /home/$uid -s /usr/bin/ksh -m -k /etc/skel $uid&lt;BR /&gt;&lt;BR /&gt;#echo $i $uid $comment&lt;BR /&gt;&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;This is the output:&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;root @ host3 [/var/tmp/scripts]&lt;BR /&gt;&lt;BR /&gt;# ./useradd.sh&lt;BR /&gt;&lt;BR /&gt;Adding users on host1&lt;BR /&gt;&lt;BR /&gt;Adding user user1 on host host1&lt;BR /&gt;&lt;BR /&gt;host1 user1 users1 test&lt;BR /&gt;&lt;BR /&gt;Adding users on host2&lt;BR /&gt;&lt;BR /&gt;Adding user user1 on host host2&lt;BR /&gt;&lt;BR /&gt;host2 user1 users1 test&lt;BR /&gt;&lt;BR /&gt;root @ host3 [/var/tmp/scripts]&lt;BR /&gt;&lt;BR /&gt;#&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;If I comment out ssh command and just use echo command it takes all 3 users for each host, so something is wrong with ssh command I am using, can you please help me with that:&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;root @ host3 [/var/tmp/scripts]&lt;BR /&gt;&lt;BR /&gt;# vi useradd.sh&lt;BR /&gt;&lt;BR /&gt;for i in `cat hosts`&lt;BR /&gt;&lt;BR /&gt;do&lt;BR /&gt;&lt;BR /&gt;echo "Adding users on $i"&lt;BR /&gt;&lt;BR /&gt;cat user_list | while read uid comment&lt;BR /&gt;&lt;BR /&gt;do&lt;BR /&gt;&lt;BR /&gt;echo "Adding user $uid on host $i"&lt;BR /&gt;&lt;BR /&gt;###ssh -q $i useradd -c \"$comment\" -g users -d /home/$uid -s /usr/bin/ksh -m -k /etc/skel $uid&lt;BR /&gt;&lt;BR /&gt;echo $i $uid $comment&lt;BR /&gt;&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;The output is good when ssh is commented out:&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;root @ host3 [/var/tmp/scripts]&lt;BR /&gt;&lt;BR /&gt;# ./useradd.sh&lt;BR /&gt;&lt;BR /&gt;Adding users on host1&lt;BR /&gt;&lt;BR /&gt;Adding user user1 on host host1&lt;BR /&gt;&lt;BR /&gt;host1 user1 users1 test&lt;BR /&gt;&lt;BR /&gt;Adding user user2 on host host1&lt;BR /&gt;&lt;BR /&gt;host1 user2 users2 test&lt;BR /&gt;&lt;BR /&gt;Adding user user3 on host host1&lt;BR /&gt;&lt;BR /&gt;host1 user3 users3 test&lt;BR /&gt;&lt;BR /&gt;Adding users on host2&lt;BR /&gt;&lt;BR /&gt;Adding user user1 on host host2&lt;BR /&gt;&lt;BR /&gt;host2 user1 users1 test&lt;BR /&gt;&lt;BR /&gt;Adding user user2 on host host2&lt;BR /&gt;&lt;BR /&gt;host2 user2 users2 test&lt;BR /&gt;&lt;BR /&gt;Adding user user3 on host host2&lt;BR /&gt;&lt;BR /&gt;host2 user3 users3 test&lt;BR /&gt;&lt;BR /&gt;root @ host3 [/var/tmp/scripts]&lt;BR /&gt;&lt;BR /&gt;#&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;So, how can I use the ssh inside those 2 loops to make it working for all3 users to add to 2 hosts ?&lt;BR /&gt;I also found that it does not work with any ssh commands, even if I did "ssh host1 ll" inside that wile loop&lt;BR /&gt;if I do ll locally it works with all 3 users,&lt;BR /&gt;&lt;BR /&gt;Also if I use only 1st "for" loop and use the fixed user it works.&lt;BR /&gt;&lt;BR /&gt;Thank you.&lt;BR /&gt;Mike.&lt;BR /&gt;</description>
      <pubDate>Thu, 10 Dec 2009 23:28:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/useradd-script-question/m-p/4548111#M370288</guid>
      <dc:creator>emp001</dc:creator>
      <dc:date>2009-12-10T23:28:33Z</dc:date>
    </item>
    <item>
      <title>Re: useradd script question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/useradd-script-question/m-p/4548112#M370289</link>
      <description>Hi Mike:&lt;BR /&gt;&lt;BR /&gt;Add the '-n' option :&lt;BR /&gt;&lt;BR /&gt;# ssh -q $i -n useradd -c \"$comment\" -g users -d /home/$uid -s /usr/bin/ksh -m -k /etc/skel $uid&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 10 Dec 2009 23:47:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/useradd-script-question/m-p/4548112#M370289</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-12-10T23:47:14Z</dc:date>
    </item>
    <item>
      <title>Re: useradd script question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/useradd-script-question/m-p/4548113#M370290</link>
      <description>Thank you very much it is working, it is quick and great.&lt;BR /&gt;&lt;BR /&gt;Mike</description>
      <pubDate>Thu, 10 Dec 2009 23:52:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/useradd-script-question/m-p/4548113#M370290</guid>
      <dc:creator>emp001</dc:creator>
      <dc:date>2009-12-10T23:52:58Z</dc:date>
    </item>
    <item>
      <title>Re: useradd script question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/useradd-script-question/m-p/4548114#M370291</link>
      <description>Hi (again) Mike:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Thank you very much it is working, it is quick and great.&lt;BR /&gt;&lt;BR /&gt;I'm happy to have helped.  Help future readers find useful answers too by taking a few minutes to read:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://forums13.itrc.hp.com/service/forums/helptips.do?#28" target="_blank"&gt;https://forums13.itrc.hp.com/service/forums/helptips.do?#28&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 11 Dec 2009 00:00:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/useradd-script-question/m-p/4548114#M370291</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-12-11T00:00:38Z</dc:date>
    </item>
    <item>
      <title>Re: useradd script question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/useradd-script-question/m-p/4548115#M370292</link>
      <description>Sorry, the points are submitted</description>
      <pubDate>Fri, 11 Dec 2009 00:06:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/useradd-script-question/m-p/4548115#M370292</guid>
      <dc:creator>emp001</dc:creator>
      <dc:date>2009-12-11T00:06:35Z</dc:date>
    </item>
    <item>
      <title>Re: useradd script question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/useradd-script-question/m-p/4548116#M370293</link>
      <description>Hi James,&lt;BR /&gt;I got one more question,&lt;BR /&gt;&lt;BR /&gt;I am using the same script to reset the passwd and instead of useradd command I use:&lt;BR /&gt;&lt;BR /&gt;ssh -t $i -n passwd $uid inside the while loop, but it does not work, giving me the error:&lt;BR /&gt;Pseudo-terminal will not be allocated because stdin is not a terminal.&lt;BR /&gt;Changing password for user3&lt;BR /&gt;pam_chauthtok: System error&lt;BR /&gt;&lt;BR /&gt;Is there any way it can be fixed, and is there any way some how to input the hardcoded passwd ?&lt;BR /&gt;</description>
      <pubDate>Fri, 11 Dec 2009 00:38:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/useradd-script-question/m-p/4548116#M370293</guid>
      <dc:creator>emp001</dc:creator>
      <dc:date>2009-12-11T00:38:04Z</dc:date>
    </item>
    <item>
      <title>Re: useradd script question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/useradd-script-question/m-p/4548117#M370294</link>
      <description>&amp;gt;I am using the same script to reset the passwd and instead of useradd command I use:&lt;BR /&gt;&lt;BR /&gt;You might look in other threads for useradd.sam.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;ssh -t $i -n passwd $uid .. but it does not work, giving me the error:&lt;BR /&gt;&amp;gt;Pseudo-terminal will not be allocated because stdin is not a terminal.&lt;BR /&gt;&lt;BR /&gt;You need that -n to work with loops.  But that -n is preventing passwd from working.  Catch-22.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;is there any way some how to input the hardcoded passwd?&lt;BR /&gt;&lt;BR /&gt;useradd.sam?</description>
      <pubDate>Fri, 11 Dec 2009 09:18:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/useradd-script-question/m-p/4548117#M370294</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-12-11T09:18:20Z</dc:date>
    </item>
    <item>
      <title>Re: useradd script question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/useradd-script-question/m-p/4548118#M370295</link>
      <description>What is the sintax to use the useradd.sam creating the user remotely with the passwd using ssh ?</description>
      <pubDate>Fri, 11 Dec 2009 16:24:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/useradd-script-question/m-p/4548118#M370295</guid>
      <dc:creator>emp001</dc:creator>
      <dc:date>2009-12-11T16:24:03Z</dc:date>
    </item>
    <item>
      <title>Re: useradd script question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/useradd-script-question/m-p/4548119#M370296</link>
      <description>what is the syntax of useradd.sam command ?&lt;BR /&gt;or do you have sny other ideas how to reset passwd on the servers remotely via ssh ???&lt;BR /&gt;&lt;BR /&gt;Thank you.&lt;BR /&gt;Mike.</description>
      <pubDate>Sat, 12 Dec 2009 00:15:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/useradd-script-question/m-p/4548119#M370296</guid>
      <dc:creator>emp001</dc:creator>
      <dc:date>2009-12-12T00:15:30Z</dc:date>
    </item>
    <item>
      <title>Re: useradd script question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/useradd-script-question/m-p/4548120#M370297</link>
      <description>&amp;gt;&amp;gt; do you have sny other ideas how to reset passwd on the servers remotely via ssh ??&amp;lt;&amp;lt;&lt;BR /&gt;&lt;BR /&gt;Check below Link&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.unix.com/unix-advanced-expert-users/43352-using-ssh-change-password-remotely.html" target="_blank"&gt;http://www.unix.com/unix-advanced-expert-users/43352-using-ssh-change-password-remotely.html&lt;/A&gt;</description>
      <pubDate>Sat, 12 Dec 2009 00:37:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/useradd-script-question/m-p/4548120#M370297</guid>
      <dc:creator>Johnson Punniyalingam</dc:creator>
      <dc:date>2009-12-12T00:37:27Z</dc:date>
    </item>
    <item>
      <title>Re: useradd script question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/useradd-script-question/m-p/4548121#M370298</link>
      <description>Is there any way ro add user in sudo on several hosts remotely via ssh ?</description>
      <pubDate>Mon, 14 Dec 2009 18:35:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/useradd-script-question/m-p/4548121#M370298</guid>
      <dc:creator>emp001</dc:creator>
      <dc:date>2009-12-14T18:35:37Z</dc:date>
    </item>
  </channel>
</rss>

