<?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: Starting procs requiring specific user/UID in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/starting-procs-requiring-specific-user-uid/m-p/2836334#M711364</link>
    <description>Hi Mike,&lt;BR /&gt;&lt;BR /&gt;We use MC/SG and we use it to start plenty of processes, mostly Oracle databases, by su'ing to the Oracle user and running a script.  It makes it easier for us and our DBAs as SG su's and calls a specific script, which the DBAs own, which allows them to update and maintain the script without requiring any SG changes.&lt;BR /&gt;&lt;BR /&gt;You have a control file for each package, and in that control file you have separate functions for customer defined start and stop functions.  You can put most anything you can get away with in a shell script into those functions, and that is where we do things like:&lt;BR /&gt;&lt;BR /&gt;su - someuser /opt/someuser/somescript&lt;BR /&gt;&lt;BR /&gt;Which gives control to someuser and keeps it cleaner for everybody.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;JP&lt;BR /&gt;</description>
    <pubDate>Wed, 30 Oct 2002 20:06:00 GMT</pubDate>
    <dc:creator>John Poff</dc:creator>
    <dc:date>2002-10-30T20:06:00Z</dc:date>
    <item>
      <title>Starting procs requiring specific user/UID</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/starting-procs-requiring-specific-user-uid/m-p/2836331#M711361</link>
      <description>Hey Folks, &lt;BR /&gt;&lt;BR /&gt;Have another one.  We would like to use Service Guard to start a processes which are required to be started by specific users.  Although setting the SUID might work, our concern is this ...&lt;BR /&gt;&lt;BR /&gt;Currently, these processes are being started manually by "su -"ing to the user (note the "-" which calls the profile) and then running the command.  The concern is that different admins control the different accounts, and want to be able to make changes to the profile (paths and such) which may be critical to the process being started WITHOUT having to change anything in Service Guard.&lt;BR /&gt;&lt;BR /&gt;The first option that came to mind was to write a script which "su - "s to the correct user and then runs the command (SG is NOT going to be montioring any of these processes, so it can use a script to start the processes.)  HOWEVER, I vaguely recall being able to tell SG to run certain commands as certain users, but I cannot find this in the manuals.&lt;BR /&gt;&lt;BR /&gt;Does SG have the capability to run different commands as different users WITHIN THE SAME PACKAGE...or am I hallucinating?&lt;BR /&gt;&lt;BR /&gt;Thanks!&lt;BR /&gt;&lt;BR /&gt;Mike&lt;BR /&gt;</description>
      <pubDate>Wed, 30 Oct 2002 20:00:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/starting-procs-requiring-specific-user-uid/m-p/2836331#M711361</guid>
      <dc:creator>Mike_316</dc:creator>
      <dc:date>2002-10-30T20:00:43Z</dc:date>
    </item>
    <item>
      <title>Re: Starting procs requiring specific user/UID</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/starting-procs-requiring-specific-user-uid/m-p/2836332#M711362</link>
      <description>Your startup commands can use su BUT you DO NOT WANT to use su - to load the .profile. THe problem is that the .profile almost certainly has commands that expect an interactive environment like stty, tset, tabs ... and these puppies are going to hang. The elegant way to do this is to create a file, e.g.&lt;BR /&gt;/usr/local/bin/myenv.sh that sets and exports any needed variables. Make sure that there are no returns or exits in this file. Next, you package scripts AND .profiles include this script using 'dot' e.g. . /usr/local/bin/myenv.sh.&lt;BR /&gt;That way bith the interactive and non-interactive environments have exactly the same variables and you only need to change them in one place should variables need to be revised in some way.&lt;BR /&gt;</description>
      <pubDate>Wed, 30 Oct 2002 20:03:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/starting-procs-requiring-specific-user-uid/m-p/2836332#M711362</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-10-30T20:03:53Z</dc:date>
    </item>
    <item>
      <title>Re: Starting procs requiring specific user/UID</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/starting-procs-requiring-specific-user-uid/m-p/2836333#M711363</link>
      <description>Hi Mike,&lt;BR /&gt;&lt;BR /&gt;Yes &amp;amp; Yes.&lt;BR /&gt;&lt;BR /&gt;In the pkg control file &amp;amp; in the customer_defined_run_cmds function you'd put commands like:&lt;BR /&gt;&lt;BR /&gt;su - user_name1 -c "/path/to/command_to_run"&lt;BR /&gt;&lt;BR /&gt;su - user_name2 -c "/path/to/command_to_run2"&lt;BR /&gt;&lt;BR /&gt;etc.......&lt;BR /&gt;&lt;BR /&gt;We do it here all the time. Works fine.&lt;BR /&gt;&lt;BR /&gt;Rgds,&lt;BR /&gt;Jeff</description>
      <pubDate>Wed, 30 Oct 2002 20:05:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/starting-procs-requiring-specific-user-uid/m-p/2836333#M711363</guid>
      <dc:creator>Jeff Schussele</dc:creator>
      <dc:date>2002-10-30T20:05:40Z</dc:date>
    </item>
    <item>
      <title>Re: Starting procs requiring specific user/UID</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/starting-procs-requiring-specific-user-uid/m-p/2836334#M711364</link>
      <description>Hi Mike,&lt;BR /&gt;&lt;BR /&gt;We use MC/SG and we use it to start plenty of processes, mostly Oracle databases, by su'ing to the Oracle user and running a script.  It makes it easier for us and our DBAs as SG su's and calls a specific script, which the DBAs own, which allows them to update and maintain the script without requiring any SG changes.&lt;BR /&gt;&lt;BR /&gt;You have a control file for each package, and in that control file you have separate functions for customer defined start and stop functions.  You can put most anything you can get away with in a shell script into those functions, and that is where we do things like:&lt;BR /&gt;&lt;BR /&gt;su - someuser /opt/someuser/somescript&lt;BR /&gt;&lt;BR /&gt;Which gives control to someuser and keeps it cleaner for everybody.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;JP&lt;BR /&gt;</description>
      <pubDate>Wed, 30 Oct 2002 20:06:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/starting-procs-requiring-specific-user-uid/m-p/2836334#M711364</guid>
      <dc:creator>John Poff</dc:creator>
      <dc:date>2002-10-30T20:06:00Z</dc:date>
    </item>
    <item>
      <title>Re: Starting procs requiring specific user/UID</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/starting-procs-requiring-specific-user-uid/m-p/2836335#M711365</link>
      <description>Hi Mike,&lt;BR /&gt;&lt;BR /&gt;This is nothing unusual, su is the way to go.&lt;BR /&gt;&lt;BR /&gt;Rather than use su - though, what I recommend is that you create a script that sets up your environment and just run this as a 'dot' script in your .profile and by any script that needs it. Then any changes only need to be made in one place.&lt;BR /&gt;&lt;BR /&gt;For instance your environment script is called 'app_env'. In your .profile you just place:&lt;BR /&gt;. app_env&lt;BR /&gt;&lt;BR /&gt;In any cron or Serviceguard startup script you can have something like:&lt;BR /&gt;. app_env&lt;BR /&gt;su &lt;USER&gt; -c 'command'&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;John&lt;BR /&gt;&lt;BR /&gt;&lt;/USER&gt;</description>
      <pubDate>Wed, 30 Oct 2002 20:18:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/starting-procs-requiring-specific-user-uid/m-p/2836335#M711365</guid>
      <dc:creator>John Palmer</dc:creator>
      <dc:date>2002-10-30T20:18:55Z</dc:date>
    </item>
    <item>
      <title>Re: Starting procs requiring specific user/UID</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/starting-procs-requiring-specific-user-uid/m-p/2836336#M711366</link>
      <description>Thanks to everyone!  Those were the answers I needed.  We have the option of using "su - username commandname" within the SG scripts, as well as writing scripts which parse the ".profile" before starting the item.&lt;BR /&gt;&lt;BR /&gt;One more clarification however, when using the option of "su - username commandname" am I correct in assuming that the "su -" functions as it does from the shell prompt...in other words if a change were made to "username"'s profile, changing the PATH for instance, that change would be reflected when the "commandname" was run.  Just as if I was at a command prompt and typed "su - username &lt;ENTER&gt;" and then typed "commandname &lt;ENTER&gt;".&lt;BR /&gt;&lt;BR /&gt;Is that correct?&lt;BR /&gt;&lt;BR /&gt;Thanks!&lt;BR /&gt;&lt;BR /&gt;Mike&lt;BR /&gt;&lt;/ENTER&gt;&lt;/ENTER&gt;</description>
      <pubDate>Wed, 30 Oct 2002 21:30:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/starting-procs-requiring-specific-user-uid/m-p/2836336#M711366</guid>
      <dc:creator>Mike_316</dc:creator>
      <dc:date>2002-10-30T21:30:40Z</dc:date>
    </item>
    <item>
      <title>Re: Starting procs requiring specific user/UID</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/starting-procs-requiring-specific-user-uid/m-p/2836337#M711367</link>
      <description>Mike,&lt;BR /&gt;&lt;BR /&gt;You are correct.  The 'su - user' picks up the .profile for that user, so a change in the PATH in the .profile for that user would be picked up.  That is part of the beauty of using it, but also part of the danger!  :)&lt;BR /&gt;&lt;BR /&gt;JP&lt;BR /&gt;</description>
      <pubDate>Wed, 30 Oct 2002 21:41:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/starting-procs-requiring-specific-user-uid/m-p/2836337#M711367</guid>
      <dc:creator>John Poff</dc:creator>
      <dc:date>2002-10-30T21:41:59Z</dc:date>
    </item>
    <item>
      <title>Re: Starting procs requiring specific user/UID</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/starting-procs-requiring-specific-user-uid/m-p/2836338#M711368</link>
      <description>Yes, changing the user's .profile will change the su - behavior but again you really don't want to source .profile (I know that  seems to be the easy way) because it is fraught with peril. If the .profile contains commands like tset and stty that can cause the .profile to hang or not work as expected. As I mentioned before the better answer is  just a plain vanilla su (w/o the -) to change the user but not source the .profile. BOTH the .profile and your startup commands should source the same file which sets the environment.&lt;BR /&gt;</description>
      <pubDate>Wed, 30 Oct 2002 21:44:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/starting-procs-requiring-specific-user-uid/m-p/2836338#M711368</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-10-30T21:44:37Z</dc:date>
    </item>
  </channel>
</rss>

