<?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 How to switch user by script? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-switch-user-by-script/m-p/2854776#M94451</link>
    <description>Hi friends!&lt;BR /&gt;&lt;BR /&gt;I'm needing to do a script to switch user during a session without inform a password.&lt;BR /&gt;&lt;BR /&gt;I've already tried to use expect, but there's a problem:&lt;BR /&gt;I don't get work interactive in new passord, because expect nedd a answer for each action.&lt;BR /&gt;&lt;BR /&gt;Example:&lt;BR /&gt;&lt;BR /&gt;$ expect&lt;BR /&gt;expect1.1&amp;gt; spawn su - i67844&lt;BR /&gt;spawn su - i67844&lt;BR /&gt;17383&lt;BR /&gt;&lt;BR /&gt;expect1.2&amp;gt; expect "Password:"&lt;BR /&gt;Password: expect1.3&amp;gt; send "nova2002\r"&lt;BR /&gt;&lt;BR /&gt;expect1.3&amp;gt; exit&lt;BR /&gt;&lt;BR /&gt;So, when i go out of expect, I don't get to switch user.&lt;BR /&gt;&lt;BR /&gt;I hope that you understand me.&lt;BR /&gt;&lt;BR /&gt;Thank you!!!&lt;BR /&gt;Periandro Saraiva Vaz</description>
    <pubDate>Fri, 29 Nov 2002 17:23:48 GMT</pubDate>
    <dc:creator>Periandro Saraiva Vaz</dc:creator>
    <dc:date>2002-11-29T17:23:48Z</dc:date>
    <item>
      <title>How to switch user by script?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-switch-user-by-script/m-p/2854776#M94451</link>
      <description>Hi friends!&lt;BR /&gt;&lt;BR /&gt;I'm needing to do a script to switch user during a session without inform a password.&lt;BR /&gt;&lt;BR /&gt;I've already tried to use expect, but there's a problem:&lt;BR /&gt;I don't get work interactive in new passord, because expect nedd a answer for each action.&lt;BR /&gt;&lt;BR /&gt;Example:&lt;BR /&gt;&lt;BR /&gt;$ expect&lt;BR /&gt;expect1.1&amp;gt; spawn su - i67844&lt;BR /&gt;spawn su - i67844&lt;BR /&gt;17383&lt;BR /&gt;&lt;BR /&gt;expect1.2&amp;gt; expect "Password:"&lt;BR /&gt;Password: expect1.3&amp;gt; send "nova2002\r"&lt;BR /&gt;&lt;BR /&gt;expect1.3&amp;gt; exit&lt;BR /&gt;&lt;BR /&gt;So, when i go out of expect, I don't get to switch user.&lt;BR /&gt;&lt;BR /&gt;I hope that you understand me.&lt;BR /&gt;&lt;BR /&gt;Thank you!!!&lt;BR /&gt;Periandro Saraiva Vaz</description>
      <pubDate>Fri, 29 Nov 2002 17:23:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-switch-user-by-script/m-p/2854776#M94451</guid>
      <dc:creator>Periandro Saraiva Vaz</dc:creator>
      <dc:date>2002-11-29T17:23:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to switch user by script?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-switch-user-by-script/m-p/2854777#M94452</link>
      <description>If you are willing to do your stuff with Perl it would be as easy as assignments to the special vars that represent EUID, UID, EGID, GID&lt;BR /&gt;(read "perldoc perlvar")&lt;BR /&gt;&lt;BR /&gt;e.g.&lt;BR /&gt;&lt;BR /&gt;$&amp;gt;  = $&amp;lt;;&lt;BR /&gt;&lt;BR /&gt;or&lt;BR /&gt;&lt;BR /&gt;($&amp;gt;, $&amp;lt;) = ($&amp;lt;, $&amp;gt;);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;$&amp;gt;  # is EUID&lt;BR /&gt;$&amp;lt;  # is UID&lt;BR /&gt;$)   # is EGID&lt;BR /&gt;$(   # is GID&lt;BR /&gt;&lt;BR /&gt;(or "use English", see "perldoc English")&lt;BR /&gt;&lt;BR /&gt;...provided you started your script with sufficient privileges (or have it run with suid bit set).&lt;BR /&gt;&lt;BR /&gt;You also can easily fork() and exec() where you swap IDs for the child to restrict possible damage.&lt;BR /&gt;&lt;BR /&gt;Read "perldoc perlipc"&lt;BR /&gt;&lt;BR /&gt;Btw, there is even an Expect.pm at CPAN&lt;BR /&gt;&lt;A href="http://www.cpan.org/modules/by-module/Expect/" target="_blank"&gt;http://www.cpan.org/modules/by-module/Expect/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 29 Nov 2002 17:36:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-switch-user-by-script/m-p/2854777#M94452</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2002-11-29T17:36:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to switch user by script?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-switch-user-by-script/m-p/2854778#M94453</link>
      <description>&lt;BR /&gt;have you tried "sudo" ??&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://hpux.cs.utah.edu/hppd/hpux/Sysadmin/sudo-1.6.6/" target="_blank"&gt;http://hpux.cs.utah.edu/hppd/hpux/Sysadmin/sudo-1.6.6/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Sun, 01 Dec 2002 04:22:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-switch-user-by-script/m-p/2854778#M94453</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2002-12-01T04:22:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to switch user by script?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-switch-user-by-script/m-p/2854779#M94454</link>
      <description>Hi Harry,&lt;BR /&gt;&lt;BR /&gt;I didn't try to use a sudo because I don't know it. Do you have an example to solve my problem?&lt;BR /&gt;&lt;BR /&gt;Is there a way to solve using a table of "user's equivalence"?</description>
      <pubDate>Mon, 02 Dec 2002 17:10:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-switch-user-by-script/m-p/2854779#M94454</guid>
      <dc:creator>Periandro Saraiva Vaz</dc:creator>
      <dc:date>2002-12-02T17:10:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to switch user by script?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-switch-user-by-script/m-p/2854780#M94455</link>
      <description>If you enable the second user to be remsh'd, then you can use that.&lt;BR /&gt;&lt;BR /&gt;For second user, in .rhosts add&lt;BR /&gt;hostname username&lt;BR /&gt;&lt;BR /&gt;Then in your script, remsh to your own hostname as the second user.&lt;BR /&gt;&lt;BR /&gt;eg: rlogin `hostname` -l seconduser&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;We use this to let oracle become applmgr in our oracle financials environment. This is acceptable because oracle is a "higher" privileged user than applmgr.</description>
      <pubDate>Thu, 05 Dec 2002 14:49:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-switch-user-by-script/m-p/2854780#M94455</guid>
      <dc:creator>Bill Cahill</dc:creator>
      <dc:date>2002-12-05T14:49:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to switch user by script?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-switch-user-by-script/m-p/2854781#M94456</link>
      <description>Periandro,&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.onlamp.com/lpt/a/2704" target="_blank"&gt;http://www.onlamp.com/lpt/a/2704&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Thu, 05 Dec 2002 15:15:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-switch-user-by-script/m-p/2854781#M94456</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2002-12-05T15:15:01Z</dc:date>
    </item>
  </channel>
</rss>

