<?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: Script running root but one command need to be run with another user in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-running-root-but-one-command-need-to-be-run-with-another/m-p/5125283#M448580</link>
    <description>Using double quotes means that the variable $ORACLE_HOME is interpolated by the (root) shell running the script instead of the shell started by su as oracle. If you have ORACLE_HOME defined in the oracle user's .profile or something similar then you can enclose the command in single quotes or escape the dollar sign with a backslash.</description>
    <pubDate>Mon, 18 Aug 2008 14:54:48 GMT</pubDate>
    <dc:creator>Heironimus</dc:creator>
    <dc:date>2008-08-18T14:54:48Z</dc:date>
    <item>
      <title>Script running root but one command need to be run with another user</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-running-root-but-one-command-need-to-be-run-with-another/m-p/5125278#M448575</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;I've a script running with root to execute some root commands and in this same script some commands needs to be run under another user. &lt;BR /&gt;&lt;BR /&gt;My script:&lt;BR /&gt;1. root command&lt;BR /&gt;2. root command&lt;BR /&gt;3. here user2 command&lt;BR /&gt;4. root command&lt;BR /&gt;5. root command&lt;BR /&gt;6. here user2 command&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I need to run 3 and 6 with the user2 because some processes will be started and the owner of the process must be user2 !&lt;BR /&gt;&lt;BR /&gt;How to do this ?&lt;BR /&gt;note: I don't want two scripts. &lt;BR /&gt;&lt;BR /&gt;Is it possible ?&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Den</description>
      <pubDate>Mon, 18 Aug 2008 13:40:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-running-root-but-one-command-need-to-be-run-with-another/m-p/5125278#M448575</guid>
      <dc:creator>Leo The Cat</dc:creator>
      <dc:date>2008-08-18T13:40:26Z</dc:date>
    </item>
    <item>
      <title>Re: Script running root but one command need to be run with another user</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-running-root-but-one-command-need-to-be-run-with-another/m-p/5125279#M448576</link>
      <description>Hi Den:&lt;BR /&gt;&lt;BR /&gt;For your non-root tasks, you can do:&lt;BR /&gt;&lt;BR /&gt;# su - someuser -c "some_command;another_command"&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 18 Aug 2008 13:46:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-running-root-but-one-command-need-to-be-run-with-another/m-p/5125279#M448576</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-08-18T13:46:31Z</dc:date>
    </item>
    <item>
      <title>Re: Script running root but one command need to be run with another user</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-running-root-but-one-command-need-to-be-run-with-another/m-p/5125280#M448577</link>
      <description>did you try this ?&lt;BR /&gt;&lt;BR /&gt;1. root command&lt;BR /&gt;2. root command&lt;BR /&gt;3. su - user2 -c "command1; command2; command3"&lt;BR /&gt;4. root command&lt;BR /&gt;5. root command&lt;BR /&gt;6. su - user2 -c "command4; command5; command6"&lt;BR /&gt;&lt;BR /&gt;since you are root to start running this script, there should not be any problem su'ing into user2 account without a password.&lt;BR /&gt;&lt;BR /&gt;Hope this helps</description>
      <pubDate>Mon, 18 Aug 2008 13:48:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-running-root-but-one-command-need-to-be-run-with-another/m-p/5125280#M448577</guid>
      <dc:creator>Mel Burslan</dc:creator>
      <dc:date>2008-08-18T13:48:10Z</dc:date>
    </item>
    <item>
      <title>Re: Script running root but one command need to be run with another user</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-running-root-but-one-command-need-to-be-run-with-another/m-p/5125281#M448578</link>
      <description>You can make the entry in your script to switch over to perticular user.&lt;BR /&gt;&lt;BR /&gt;su - username -c "command to be executed"&lt;BR /&gt;&lt;BR /&gt;You can refer manpages for su &lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;SKR</description>
      <pubDate>Mon, 18 Aug 2008 13:51:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-running-root-but-one-command-need-to-be-run-with-another/m-p/5125281#M448578</guid>
      <dc:creator>SKR_1</dc:creator>
      <dc:date>2008-08-18T13:51:09Z</dc:date>
    </item>
    <item>
      <title>Re: Script running root but one command need to be run with another user</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-running-root-but-one-command-need-to-be-run-with-another/m-p/5125282#M448579</link>
      <description>a little problem&lt;BR /&gt;&lt;BR /&gt;In my script I've try with: &lt;BR /&gt;su - oracle -c "$ORACLE_HOME/mycommand.ksh"&lt;BR /&gt;&lt;BR /&gt;The problem is that $ORACLE_HOME is not defined and of course I've the error: ksh: /mycommand.ksh:  not found.&lt;BR /&gt;&lt;BR /&gt;How to fix this. I Need to work with ORACLE_HOME to have only one generic script ...&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Den</description>
      <pubDate>Mon, 18 Aug 2008 14:45:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-running-root-but-one-command-need-to-be-run-with-another/m-p/5125282#M448579</guid>
      <dc:creator>Leo The Cat</dc:creator>
      <dc:date>2008-08-18T14:45:35Z</dc:date>
    </item>
    <item>
      <title>Re: Script running root but one command need to be run with another user</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-running-root-but-one-command-need-to-be-run-with-another/m-p/5125283#M448580</link>
      <description>Using double quotes means that the variable $ORACLE_HOME is interpolated by the (root) shell running the script instead of the shell started by su as oracle. If you have ORACLE_HOME defined in the oracle user's .profile or something similar then you can enclose the command in single quotes or escape the dollar sign with a backslash.</description>
      <pubDate>Mon, 18 Aug 2008 14:54:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-running-root-but-one-command-need-to-be-run-with-another/m-p/5125283#M448580</guid>
      <dc:creator>Heironimus</dc:creator>
      <dc:date>2008-08-18T14:54:48Z</dc:date>
    </item>
    <item>
      <title>Re: Script running root but one command need to be run with another user</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-running-root-but-one-command-need-to-be-run-with-another/m-p/5125284#M448581</link>
      <description>If you only have one ORACLE_HOME in this server, you can set it in the root's environment. If you have several oracle versions installed, you need to calculate the value of the "ORACLE_HOME" based on the ORACLE_SID that you are executing the script against. You should use the /etc/oratab to grep the line with the correct SID and then pick-up the ORACLE_HOME from there. &lt;BR /&gt;&lt;BR /&gt;In addition to ORACLE_HOME and depending what the "su - oracle" command does, you may also need to setup the TNS_ADMIN, SHLIB_PATH, LD_LIBRARY_PATH variables.</description>
      <pubDate>Mon, 18 Aug 2008 14:54:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-running-root-but-one-command-need-to-be-run-with-another/m-p/5125284#M448581</guid>
      <dc:creator>TTr</dc:creator>
      <dc:date>2008-08-18T14:54:49Z</dc:date>
    </item>
    <item>
      <title>Re: Script running root but one command need to be run with another user</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-running-root-but-one-command-need-to-be-run-with-another/m-p/5125285#M448582</link>
      <description>I can't do this. (Admin Unix don't want!)&lt;BR /&gt;I need to have this. &lt;BR /&gt;&lt;BR /&gt;Is it possible to load the user profile with something like that (but this does not work), so just in the idea :&lt;BR /&gt;&lt;BR /&gt;su - applopus -c "(. /home/applopus/.profile &amp;gt;/dev/null; $ORACLE_HOME/backup_restore/bkp_restore.sh -m backup_instance_online)"  &lt;BR /&gt;&lt;BR /&gt;(huh!)&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Den</description>
      <pubDate>Mon, 18 Aug 2008 15:00:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-running-root-but-one-command-need-to-be-run-with-another/m-p/5125285#M448582</guid>
      <dc:creator>Leo The Cat</dc:creator>
      <dc:date>2008-08-18T15:00:12Z</dc:date>
    </item>
    <item>
      <title>Re: Script running root but one command need to be run with another user</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-running-root-but-one-command-need-to-be-run-with-another/m-p/5125286#M448583</link>
      <description>"Is it possible to load the user profile with something like that (but this does not work), so just in the idea :&lt;BR /&gt;&lt;BR /&gt;su - applopus -c "(. /home/applopus/.profile &amp;gt;/dev/null; $ORACLE_HOME/backup_restore/bkp_restore.sh -m backup_instance_online)" &lt;BR /&gt;&lt;BR /&gt;Try it with single quotes (as noted previously) , and note that running the .profile in the command string isn't necessary here, as the "-" in the su causes that to happen.&lt;BR /&gt;</description>
      <pubDate>Mon, 18 Aug 2008 15:34:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-running-root-but-one-command-need-to-be-run-with-another/m-p/5125286#M448583</guid>
      <dc:creator>OldSchool</dc:creator>
      <dc:date>2008-08-18T15:34:34Z</dc:date>
    </item>
    <item>
      <title>Re: Script running root but one command need to be run with another user</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-running-root-but-one-command-need-to-be-run-with-another/m-p/5125287#M448584</link>
      <description>It's ok with su - user and quote syntax !&lt;BR /&gt;Thanks</description>
      <pubDate>Mon, 18 Aug 2008 16:55:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-running-root-but-one-command-need-to-be-run-with-another/m-p/5125287#M448584</guid>
      <dc:creator>Leo The Cat</dc:creator>
      <dc:date>2008-08-18T16:55:07Z</dc:date>
    </item>
  </channel>
</rss>

