<?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: password for script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/password-for-script/m-p/3101313#M807458</link>
    <description>Alper.&lt;BR /&gt;&lt;BR /&gt;You have taught me something there.&lt;BR /&gt;You deserve points for that.&lt;BR /&gt;&lt;BR /&gt;-- Graham</description>
    <pubDate>Fri, 24 Oct 2003 02:58:05 GMT</pubDate>
    <dc:creator>Graham Cameron_1</dc:creator>
    <dc:date>2003-10-24T02:58:05Z</dc:date>
    <item>
      <title>password for script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/password-for-script/m-p/3101308#M807453</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I have written a script but what I want is whenever someone run the script it will prompt for the password and if its wrong exit the script.</description>
      <pubDate>Fri, 24 Oct 2003 00:06:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/password-for-script/m-p/3101308#M807453</guid>
      <dc:creator>Nitin Nigam</dc:creator>
      <dc:date>2003-10-24T00:06:35Z</dc:date>
    </item>
    <item>
      <title>Re: password for script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/password-for-script/m-p/3101309#M807454</link>
      <description>Hi Nitin,&lt;BR /&gt;I know "C" and i know that it can solve you'r problem.&lt;BR /&gt;Ok here is how you can go&lt;BR /&gt;1. read the used id.&lt;BR /&gt;2. get the salt characters from /etc/passwd or if trusted system read from tcb files (salt characters are first 2 characters of password)&lt;BR /&gt;3. read the password from keyboard and using the salt character you got from previous step, encrypt the password.&lt;BR /&gt;4. compare the password either from /etc/passwd or tcb files if trusted system.&lt;BR /&gt;If compare results ok then let user run the script or else exit. You can this way even keep log of users who ran the script.&lt;BR /&gt;</description>
      <pubDate>Fri, 24 Oct 2003 00:12:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/password-for-script/m-p/3101309#M807454</guid>
      <dc:creator>Rajeev  Shukla</dc:creator>
      <dc:date>2003-10-24T00:12:00Z</dc:date>
    </item>
    <item>
      <title>Re: password for script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/password-for-script/m-p/3101310#M807455</link>
      <description>Or do:&lt;BR /&gt;&lt;BR /&gt;su $LOGNAME -c /bin/true&lt;BR /&gt;if [ $? -ne 0 ]&lt;BR /&gt;then&lt;BR /&gt;    exit&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;LOGNAME should contain your login name, so you do a su to yourself.&lt;BR /&gt;This works in most cases. Only root doesn't need to enter his own password.</description>
      <pubDate>Fri, 24 Oct 2003 00:29:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/password-for-script/m-p/3101310#M807455</guid>
      <dc:creator>Elmar P. Kolkman</dc:creator>
      <dc:date>2003-10-24T00:29:31Z</dc:date>
    </item>
    <item>
      <title>Re: password for script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/password-for-script/m-p/3101311#M807456</link>
      <description>I guess the first thing you need to do is to prompt for a password and read it in with no echo, and I don't think you can do this purely with shell.&lt;BR /&gt;&lt;BR /&gt;You could write a small C program which would call getpass() and do your validation, returning a success/fail code which your calling script can then check.&lt;BR /&gt;&lt;BR /&gt;Unless maybe perl can do this - I'm no expert here but someone else might be able to help...&lt;BR /&gt;&lt;BR /&gt;-- Graham</description>
      <pubDate>Fri, 24 Oct 2003 02:19:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/password-for-script/m-p/3101311#M807456</guid>
      <dc:creator>Graham Cameron_1</dc:creator>
      <dc:date>2003-10-24T02:19:24Z</dc:date>
    </item>
    <item>
      <title>Re: password for script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/password-for-script/m-p/3101312#M807457</link>
      <description>Hi,&lt;BR /&gt;I guess that you would like to validate his/her unix password when this script is run by a unix account. So the most appropriate method seems the method submitted by Elmar P. Kolkman above. &lt;BR /&gt;Addition to the information gathered above, I would like to say comments about the reply submitted by Graham Cameron:&lt;BR /&gt;a-) If you want avoid showing Password you may read password interactively as &lt;BR /&gt;below.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;USERNAME="UserName" ## Could be a parameter to your script too.&lt;BR /&gt;PASSWORD=""&lt;BR /&gt;while [ ! "$PASSWORD" ]&lt;BR /&gt;do&lt;BR /&gt;echo "\t\t\tEnter ${SERVER} PASSWORD for ${USERNAME}: \c"&lt;BR /&gt;stty -echo&lt;BR /&gt;read PASSWORD&lt;BR /&gt;stty echo&lt;BR /&gt;echo ""&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;b-) As far as I know, function getpass() is limited up to 8 characters, so you'd better consider this limitation while writing codes on your platform.&lt;BR /&gt;Regards&lt;BR /&gt;ALPER ONEY&lt;BR /&gt;SYBASE DBA&lt;BR /&gt;I.S.E TAKASBANK INC</description>
      <pubDate>Fri, 24 Oct 2003 02:51:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/password-for-script/m-p/3101312#M807457</guid>
      <dc:creator>ALPER ONEY</dc:creator>
      <dc:date>2003-10-24T02:51:21Z</dc:date>
    </item>
    <item>
      <title>Re: password for script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/password-for-script/m-p/3101313#M807458</link>
      <description>Alper.&lt;BR /&gt;&lt;BR /&gt;You have taught me something there.&lt;BR /&gt;You deserve points for that.&lt;BR /&gt;&lt;BR /&gt;-- Graham</description>
      <pubDate>Fri, 24 Oct 2003 02:58:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/password-for-script/m-p/3101313#M807458</guid>
      <dc:creator>Graham Cameron_1</dc:creator>
      <dc:date>2003-10-24T02:58:05Z</dc:date>
    </item>
  </channel>
</rss>

