<?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: How to successfully su another user and run his scripts in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-successfully-su-another-user-and-run-his-scripts/m-p/2841582#M91330</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;The quotes need to surround the -c command string - not the entire command.&lt;BR /&gt;&lt;BR /&gt;Rgds,&lt;BR /&gt;Jeff</description>
    <pubDate>Fri, 08 Nov 2002 19:20:51 GMT</pubDate>
    <dc:creator>Jeff Schussele</dc:creator>
    <dc:date>2002-11-08T19:20:51Z</dc:date>
    <item>
      <title>How to successfully su another user and run his scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-successfully-su-another-user-and-run-his-scripts/m-p/2841580#M91328</link>
      <description>Hi friends,&lt;BR /&gt;&lt;BR /&gt;I want to write a simple script with following purpose:&lt;BR /&gt;&lt;BR /&gt;I want User A su User B&lt;BR /&gt;User A will run a script in User B's directory.&lt;BR /&gt;&lt;BR /&gt;$ ll test&lt;BR /&gt;-rwxrwxrwx   1 ssprod     sybase          86 Nov  8 14:07 test&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;This is what I wrote in a file "test"&lt;BR /&gt;&lt;BR /&gt;"su - UserB -c /UserB/octacom/sqllist.sh &lt;PWD&gt;&lt;/PWD&gt;&lt;BR /&gt;When I run it, nother happens. But If I run manually by su UserB and run it in UserB's diectory, it will work.  &lt;BR /&gt;Can anyone give me suggestions?&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;Yalin</description>
      <pubDate>Fri, 08 Nov 2002 19:20:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-successfully-su-another-user-and-run-his-scripts/m-p/2841580#M91328</guid>
      <dc:creator>yalin zhao</dc:creator>
      <dc:date>2002-11-08T19:20:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to successfully su another user and run his scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-successfully-su-another-user-and-run-his-scripts/m-p/2841581#M91329</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;Try this instead:&lt;BR /&gt;&lt;BR /&gt;su - UserB -c "/UserB/octacom/sqllist.sh &lt;PWD&gt;&lt;/PWD&gt;&lt;BR /&gt;Hope this helps&lt;BR /&gt;&lt;BR /&gt;Chris&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 08 Nov 2002 19:19:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-successfully-su-another-user-and-run-his-scripts/m-p/2841581#M91329</guid>
      <dc:creator>Christopher McCray_1</dc:creator>
      <dc:date>2002-11-08T19:19:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to successfully su another user and run his scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-successfully-su-another-user-and-run-his-scripts/m-p/2841582#M91330</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;The quotes need to surround the -c command string - not the entire command.&lt;BR /&gt;&lt;BR /&gt;Rgds,&lt;BR /&gt;Jeff</description>
      <pubDate>Fri, 08 Nov 2002 19:20:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-successfully-su-another-user-and-run-his-scripts/m-p/2841582#M91330</guid>
      <dc:creator>Jeff Schussele</dc:creator>
      <dc:date>2002-11-08T19:20:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to successfully su another user and run his scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-successfully-su-another-user-and-run-his-scripts/m-p/2841583#M91331</link>
      <description>Why not just change the permissions on the script?&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Fri, 08 Nov 2002 19:26:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-successfully-su-another-user-and-run-his-scripts/m-p/2841583#M91331</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2002-11-08T19:26:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to successfully su another user and run his scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-successfully-su-another-user-and-run-his-scripts/m-p/2841584#M91332</link>
      <description>I changed it to the following:&lt;BR /&gt;&lt;BR /&gt;su - UserB -c "/UserB/octacom/sqqlist.sh" &lt;PWD&gt;&lt;/PWD&gt;su - UserB -c "/UserB/octacom/sqqlist.sh &lt;PWD&gt;&lt;/PWD&gt;&lt;BR /&gt;none of them works&lt;BR /&gt;&lt;BR /&gt;Note: I changed the permission of the scripts&lt;BR /&gt;      to 777.&lt;BR /&gt;      the "&lt;PWD&gt;&lt;/PWD&gt;Any suggestions or any other way that we can do this?&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;</description>
      <pubDate>Fri, 08 Nov 2002 19:41:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-successfully-su-another-user-and-run-his-scripts/m-p/2841584#M91332</guid>
      <dc:creator>yalin zhao</dc:creator>
      <dc:date>2002-11-08T19:41:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to successfully su another user and run his scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-successfully-su-another-user-and-run-his-scripts/m-p/2841585#M91333</link>
      <description>su - userid. The - set the environment for that user. runs .profile</description>
      <pubDate>Fri, 08 Nov 2002 19:45:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-successfully-su-another-user-and-run-his-scripts/m-p/2841585#M91333</guid>
      <dc:creator>Ken Hubnik_2</dc:creator>
      <dc:date>2002-11-08T19:45:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to successfully su another user and run his scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-successfully-su-another-user-and-run-his-scripts/m-p/2841586#M91334</link>
      <description>If the permissions are 777, then why do you need to su to User B?  User A can run the script as himself.&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Fri, 08 Nov 2002 19:46:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-successfully-su-another-user-and-run-his-scripts/m-p/2841586#M91334</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2002-11-08T19:46:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to successfully su another user and run his scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-successfully-su-another-user-and-run-his-scripts/m-p/2841587#M91335</link>
      <description>AFAIK, the password must be entered interactively. I tried this a couple of months back and was not able to get it to work. My work around was to submit an "at" job instead.&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;Marty</description>
      <pubDate>Fri, 08 Nov 2002 19:47:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-successfully-su-another-user-and-run-his-scripts/m-p/2841587#M91335</guid>
      <dc:creator>Martin Johnson</dc:creator>
      <dc:date>2002-11-08T19:47:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to successfully su another user and run his scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-successfully-su-another-user-and-run-his-scripts/m-p/2841588#M91336</link>
      <description>Another thing,&lt;BR /&gt;&lt;BR /&gt;Are you calling this pwd file by it's absolute path or are you just calling the file name?&lt;BR /&gt;&lt;BR /&gt;You either have to do this:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;su - UserB -c "/UserB/octacom/sqllist.sh &lt;BR /&gt;or&lt;BR /&gt;&lt;BR /&gt;PWD=/full/path/to/pwd&lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;su - UserB -c "/UserB/octacom/sqllist.sh &amp;lt;$PWD"&lt;BR /&gt;&lt;BR /&gt;Hope this helps&lt;BR /&gt;&lt;BR /&gt;Chris&lt;BR /&gt;</description>
      <pubDate>Fri, 08 Nov 2002 19:54:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-successfully-su-another-user-and-run-his-scripts/m-p/2841588#M91336</guid>
      <dc:creator>Christopher McCray_1</dc:creator>
      <dc:date>2002-11-08T19:54:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to successfully su another user and run his scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-successfully-su-another-user-and-run-his-scripts/m-p/2841589#M91337</link>
      <description>You're not going to be able to pass the password to the su command that way. I suggest you take Pete's advice &amp;amp; set the perms such that UserA can run the script. &lt;BR /&gt;&lt;BR /&gt;Your other option would be for UserB to setup a .rhosts file that gives UserA equivalency rights to UserB.&lt;BR /&gt;&lt;BR /&gt;Rgds,&lt;BR /&gt;Jeff</description>
      <pubDate>Fri, 08 Nov 2002 19:55:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-successfully-su-another-user-and-run-his-scripts/m-p/2841589#M91337</guid>
      <dc:creator>Jeff Schussele</dc:creator>
      <dc:date>2002-11-08T19:55:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to successfully su another user and run his scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-successfully-su-another-user-and-run-his-scripts/m-p/2841590#M91338</link>
      <description>You have a more fundamental problem. The su - rather than simply su is killing you. You want to source the user's .profile but almost certainly .profile expects an interactive (i.e. a terminal for stdin). Commands like stty, tset, and tabs will hang if stdin is not a tty device. &lt;BR /&gt;&lt;BR /&gt;There are two ways to make this work:&lt;BR /&gt;1) surround any of the commands which deal with the terminal with&lt;BR /&gt;if [ -t 0 ]&lt;BR /&gt;  then&lt;BR /&gt;    tset ....&lt;BR /&gt;    stty ....&lt;BR /&gt;    tabs ...&lt;BR /&gt;  fi&lt;BR /&gt;&lt;BR /&gt;-t 0 is true if stdin (0) is a terminal device.&lt;BR /&gt;&lt;BR /&gt;2) better&lt;BR /&gt;have a file that both .profile and your script sources (e.g) . /usr/local/bin/myenv.sh&lt;BR /&gt;&lt;BR /&gt;myenv.sh would then set and export any needed vars.&lt;BR /&gt;&lt;BR /&gt;There should be no exits or returns in this file.&lt;BR /&gt;</description>
      <pubDate>Fri, 08 Nov 2002 19:57:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-successfully-su-another-user-and-run-his-scripts/m-p/2841590#M91338</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-11-08T19:57:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to successfully su another user and run his scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-successfully-su-another-user-and-run-his-scripts/m-p/2841591#M91339</link>
      <description>I just saw where you want a non-root user to be able to do this. NO way - it would be an unbelieable security hole if possible. What you can do is setup a sudo command. You can get sudo from:&lt;BR /&gt;&lt;A href="http://gatekeep.cs.utah.edu/hppd/hpux/Sysadmin/sudo-1.6.6/" target="_blank"&gt;http://gatekeep.cs.utah.edu/hppd/hpux/Sysadmin/sudo-1.6.6/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 08 Nov 2002 20:00:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-successfully-su-another-user-and-run-his-scripts/m-p/2841591#M91339</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-11-08T20:00:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to successfully su another user and run his scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-successfully-su-another-user-and-run-his-scripts/m-p/2841592#M91340</link>
      <description>I use that su method on bootup in my rc scripts. I have a special Daemon user. Who runs network daemons i.e the cognos license manager. I do not want to run them as root, and the way described above is the way I do it with the only exception being that i nohup it.&lt;BR /&gt;&lt;BR /&gt;/bin/nohup /bin/su - phlmgrd -c '/opt/cognos/license1/lmgrd /opt/cognos/license1/lmgrd.log2&amp;gt; /opt/cognos/license1/lmgrd.err &amp;amp; '&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Gerhard&lt;BR /&gt;</description>
      <pubDate>Mon, 11 Nov 2002 17:21:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-successfully-su-another-user-and-run-his-scripts/m-p/2841592#M91340</guid>
      <dc:creator>Gerhard Roets</dc:creator>
      <dc:date>2002-11-11T17:21:51Z</dc:date>
    </item>
  </channel>
</rss>

