<?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: User password in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/user-password/m-p/3756919#M258643</link>
    <description>Reading one character at a time from the shell is a far from trivial exercise. It can be done with dd but it is a kludge. A better approach is a small C program that will, in addition, disable echo'ing and will make sure that the terminal is not left in a noecho state. If you do a stty -noecho in a shell is is very important that you trap SIGINT,SIGHUP, and exits and restore the terminal because the stty command affects no just the process but the terminal itself. ie, if you exit the process the terminal is still in a noecho state.&lt;BR /&gt;&lt;BR /&gt;Use the attached small program. It's done in K&amp;amp;R C intentionally so that even the Bundled compiler willl handle it. It also filters out unprintable characters.&lt;BR /&gt;&lt;BR /&gt;Compile it like this:&lt;BR /&gt;cc onechar.c -o onechar&lt;BR /&gt;&lt;BR /&gt;Now install onechar somewhere in your PATH (e.g. /usr/local/bin).&lt;BR /&gt;&lt;BR /&gt;You can invoke it as "onechar -u" for usage.&lt;BR /&gt;&lt;BR /&gt;Use it like this:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;typeset -i STAT=0&lt;BR /&gt;typeset PW=""&lt;BR /&gt;typeset X=""&lt;BR /&gt;echo "Enter password: \c"&lt;BR /&gt;while [[ ${STAT} -eq 0 ]]&lt;BR /&gt;  do&lt;BR /&gt;     X=$(onechar)&lt;BR /&gt;     STAT=${?}&lt;BR /&gt;     if [[ ${STAT} -eq 0 ]]&lt;BR /&gt;       then # printable character read&lt;BR /&gt;         echo "*\c"&lt;BR /&gt;         PW="${PW}${X}"&lt;BR /&gt;       fi&lt;BR /&gt;  done&lt;BR /&gt;echo&lt;BR /&gt;&lt;BR /&gt;echo "Password = \"${PW}\""  &lt;BR /&gt;</description>
    <pubDate>Wed, 22 Mar 2006 15:46:26 GMT</pubDate>
    <dc:creator>A. Clay Stephenson</dc:creator>
    <dc:date>2006-03-22T15:46:26Z</dc:date>
    <item>
      <title>User password</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/user-password/m-p/3756918#M258642</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I am runing a script which prompt for user to input the password I turn off the echo so that the password doesn't echo (stty -echo), now what I want is to echo **** when user input the password, can some one help how to achive this.&lt;BR /&gt;&lt;BR /&gt;Thanks in advance</description>
      <pubDate>Wed, 22 Mar 2006 15:04:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/user-password/m-p/3756918#M258642</guid>
      <dc:creator>Anthony khan</dc:creator>
      <dc:date>2006-03-22T15:04:57Z</dc:date>
    </item>
    <item>
      <title>Re: User password</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/user-password/m-p/3756919#M258643</link>
      <description>Reading one character at a time from the shell is a far from trivial exercise. It can be done with dd but it is a kludge. A better approach is a small C program that will, in addition, disable echo'ing and will make sure that the terminal is not left in a noecho state. If you do a stty -noecho in a shell is is very important that you trap SIGINT,SIGHUP, and exits and restore the terminal because the stty command affects no just the process but the terminal itself. ie, if you exit the process the terminal is still in a noecho state.&lt;BR /&gt;&lt;BR /&gt;Use the attached small program. It's done in K&amp;amp;R C intentionally so that even the Bundled compiler willl handle it. It also filters out unprintable characters.&lt;BR /&gt;&lt;BR /&gt;Compile it like this:&lt;BR /&gt;cc onechar.c -o onechar&lt;BR /&gt;&lt;BR /&gt;Now install onechar somewhere in your PATH (e.g. /usr/local/bin).&lt;BR /&gt;&lt;BR /&gt;You can invoke it as "onechar -u" for usage.&lt;BR /&gt;&lt;BR /&gt;Use it like this:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;typeset -i STAT=0&lt;BR /&gt;typeset PW=""&lt;BR /&gt;typeset X=""&lt;BR /&gt;echo "Enter password: \c"&lt;BR /&gt;while [[ ${STAT} -eq 0 ]]&lt;BR /&gt;  do&lt;BR /&gt;     X=$(onechar)&lt;BR /&gt;     STAT=${?}&lt;BR /&gt;     if [[ ${STAT} -eq 0 ]]&lt;BR /&gt;       then # printable character read&lt;BR /&gt;         echo "*\c"&lt;BR /&gt;         PW="${PW}${X}"&lt;BR /&gt;       fi&lt;BR /&gt;  done&lt;BR /&gt;echo&lt;BR /&gt;&lt;BR /&gt;echo "Password = \"${PW}\""  &lt;BR /&gt;</description>
      <pubDate>Wed, 22 Mar 2006 15:46:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/user-password/m-p/3756919#M258643</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2006-03-22T15:46:26Z</dc:date>
    </item>
    <item>
      <title>Re: User password</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/user-password/m-p/3756920#M258644</link>
      <description>I am getting the following errors.&lt;BR /&gt;&lt;BR /&gt;./test1: typeset: not found&lt;BR /&gt;./test1: typeset: not found&lt;BR /&gt;./test1: typeset: not found&lt;BR /&gt;Enter password: ./test1: syntax error at line 10: `X=' unexpected</description>
      <pubDate>Wed, 22 Mar 2006 16:23:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/user-password/m-p/3756920#M258644</guid>
      <dc:creator>Anthony khan</dc:creator>
      <dc:date>2006-03-22T16:23:53Z</dc:date>
    </item>
    <item>
      <title>Re: User password</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/user-password/m-p/3756921#M258645</link>
      <description>typeset is a shell built-in for POSIX, Korn, andn Bash -- so what shell are you running? &lt;BR /&gt;</description>
      <pubDate>Wed, 22 Mar 2006 16:27:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/user-password/m-p/3756921#M258645</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2006-03-22T16:27:30Z</dc:date>
    </item>
    <item>
      <title>Re: User password</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/user-password/m-p/3756922#M258646</link>
      <description>Thanks Clay I was using ksh, it's working now.</description>
      <pubDate>Wed, 22 Mar 2006 16:34:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/user-password/m-p/3756922#M258646</guid>
      <dc:creator>Anthony khan</dc:creator>
      <dc:date>2006-03-22T16:34:23Z</dc:date>
    </item>
  </channel>
</rss>

