<?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: expect problems changing password in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-problems-changing-password/m-p/3230293#M171920</link>
    <description>Back to top. I posted this late in the day yesterday and am not at all sure too many people saw this.  I cannot believe I've uncovered anything unique here.&lt;BR /&gt;&lt;BR /&gt;The user ID "testuser" does exist, and I can change the password for that ID interactively via sam or the commandline.&lt;BR /&gt;&lt;BR /&gt;mark</description>
    <pubDate>Fri, 26 Mar 2004 08:16:50 GMT</pubDate>
    <dc:creator>Mark Greene_1</dc:creator>
    <dc:date>2004-03-26T08:16:50Z</dc:date>
    <item>
      <title>expect problems changing password</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-problems-changing-password/m-p/3230292#M171919</link>
      <description>I have the following expect commaned embedded within a ksh script:&lt;BR /&gt;&lt;BR /&gt;reset_password() {&lt;BR /&gt;   UNAME=$LoginID&lt;BR /&gt;   UPASS=$NEWPASS&lt;BR /&gt;&lt;BR /&gt;   /usr/local/bin/expect -d &amp;lt;&lt;EOF&gt;&lt;/EOF&gt;   set timeout -1&lt;BR /&gt;   match_max 100000&lt;BR /&gt;   spawn passwd $UNAME\r&lt;BR /&gt;   expect -exact "Changing password for testuser\r&lt;BR /&gt;New password: "&lt;BR /&gt;   send "$UPASS\r"&lt;BR /&gt;   expect "Re-enter new password:"&lt;BR /&gt;   send "$UPASS\r"&lt;BR /&gt;   send "exit\r"&lt;BR /&gt;EOF&lt;BR /&gt;&lt;BR /&gt;return $?&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I am getting this output from the expect debugger:&lt;BR /&gt;&lt;BR /&gt;expect version 5.39.0&lt;BR /&gt;argv[0] = /usr/local/bin/expect  argv[1] = -d  &lt;BR /&gt;set argc 0&lt;BR /&gt;set argv0 "/usr/local/bin/expect"&lt;BR /&gt;set argv ""&lt;BR /&gt;executing commands from command file&lt;BR /&gt;spawn passwd testuser&lt;BR /&gt;parent: waiting for sync byte&lt;BR /&gt;parent: telling child to go ahead&lt;BR /&gt;parent: now unsynchronized from child&lt;BR /&gt;spawn: returns {26705}&lt;BR /&gt;&lt;BR /&gt;expect: does "" (spawn_id exp6) match exact string "Changing password for testuser\r\nNew password: "? no&lt;BR /&gt;Invalid login name.&lt;BR /&gt;&lt;BR /&gt;expect: does "Invalid login name.\r\n" (spawn_id exp6) match exact string "Changing password for testuser\r\nNew password: "? no&lt;BR /&gt;expect: read eof&lt;BR /&gt;expect: set expect_out(spawn_id) "exp6"&lt;BR /&gt;expect: set expect_out(buffer) "Invalid login name.\r\n"&lt;BR /&gt;send: sending "test123\r" to { exp6 send: spawn id exp6 not open&lt;BR /&gt;    while executing&lt;BR /&gt;"send "test123\r""&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Looks like either a timing problem or a problem with too many or too few control characters on the "spawn" line.  Can anyone tell me what to fix?&lt;BR /&gt;&lt;BR /&gt;TIA&lt;BR /&gt;mark</description>
      <pubDate>Thu, 25 Mar 2004 15:53:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect-problems-changing-password/m-p/3230292#M171919</guid>
      <dc:creator>Mark Greene_1</dc:creator>
      <dc:date>2004-03-25T15:53:57Z</dc:date>
    </item>
    <item>
      <title>Re: expect problems changing password</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-problems-changing-password/m-p/3230293#M171920</link>
      <description>Back to top. I posted this late in the day yesterday and am not at all sure too many people saw this.  I cannot believe I've uncovered anything unique here.&lt;BR /&gt;&lt;BR /&gt;The user ID "testuser" does exist, and I can change the password for that ID interactively via sam or the commandline.&lt;BR /&gt;&lt;BR /&gt;mark</description>
      <pubDate>Fri, 26 Mar 2004 08:16:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect-problems-changing-password/m-p/3230293#M171920</guid>
      <dc:creator>Mark Greene_1</dc:creator>
      <dc:date>2004-03-26T08:16:50Z</dc:date>
    </item>
    <item>
      <title>Re: expect problems changing password</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-problems-changing-password/m-p/3230294#M171921</link>
      <description>&lt;BR /&gt;Hi Mark, i don't know expect, but in shell script sometimes the variable name needs braces around it. &lt;BR /&gt;&lt;BR /&gt;For example:&lt;BR /&gt;the line &lt;BR /&gt;spawn passwd $UNAME\r  will be:&lt;BR /&gt;spawn passwd ${UNAME}\r&lt;BR /&gt;&lt;BR /&gt;and perhaps \n instead of \r&lt;BR /&gt;&lt;BR /&gt;Frank.</description>
      <pubDate>Fri, 26 Mar 2004 08:47:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect-problems-changing-password/m-p/3230294#M171921</guid>
      <dc:creator>Francisco J. Soler</dc:creator>
      <dc:date>2004-03-26T08:47:36Z</dc:date>
    </item>
    <item>
      <title>Re: expect problems changing password</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-problems-changing-password/m-p/3230295#M171922</link>
      <description>You're probably correct about the spawn line.&lt;BR /&gt;&lt;BR /&gt;You should just need to use&lt;BR /&gt;&lt;BR /&gt;spawn passwd $UNAME&lt;BR /&gt;&lt;BR /&gt;(we use expect with some scripts via telnet using "spawn telnet $SERVER")&lt;BR /&gt;&lt;BR /&gt;the "\r" is seen as a carriage return when using echo and a few other commands, but even then, it needs to be surrounded by quotes to be interpreted correctly.&lt;BR /&gt;&lt;BR /&gt;You can see this behaviour using&lt;BR /&gt;&lt;BR /&gt;echo "\r"&lt;BR /&gt;&lt;BR /&gt;and&lt;BR /&gt;&lt;BR /&gt;echo \r&lt;BR /&gt;</description>
      <pubDate>Fri, 26 Mar 2004 09:04:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect-problems-changing-password/m-p/3230295#M171922</guid>
      <dc:creator>Chris Wilshaw</dc:creator>
      <dc:date>2004-03-26T09:04:30Z</dc:date>
    </item>
    <item>
      <title>Re: expect problems changing password</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-problems-changing-password/m-p/3230296#M171923</link>
      <description>Taking the \r out of the spawn statement did it, thanks guys!&lt;BR /&gt;&lt;BR /&gt;mark</description>
      <pubDate>Fri, 26 Mar 2004 09:26:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect-problems-changing-password/m-p/3230296#M171923</guid>
      <dc:creator>Mark Greene_1</dc:creator>
      <dc:date>2004-03-26T09:26:38Z</dc:date>
    </item>
  </channel>
</rss>

