<?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: initialize with a user different from root in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/initialize-with-a-user-different-from-root/m-p/2920204#M109328</link>
    <description>The problem is that you are doing a su - my_user rather than a su my_user. I know that you want to invoke my_user's .profile BUT that is your problem. The .profile contains commands like tset, stty, and tabs that expect an interactive environment - which you ain't.&lt;BR /&gt;&lt;BR /&gt;The best solution is to create a script e.g. /usr/local/bin/my_user_env.sh (that contains no exit or return statements). This script will set all the environment vars and then this script is sourced (via . /usr/local/bin/my_user_env.sh) by BOTH your init.d command AND my_user's .profile. &lt;BR /&gt;&lt;BR /&gt;The less good way is to surround all the interactive commands in .profile with&lt;BR /&gt;if [ -t 0 ]&lt;BR /&gt;then&lt;BR /&gt;  tset&lt;BR /&gt;  stty ..&lt;BR /&gt;fi&lt;BR /&gt;</description>
    <pubDate>Wed, 05 Mar 2003 20:39:33 GMT</pubDate>
    <dc:creator>A. Clay Stephenson</dc:creator>
    <dc:date>2003-03-05T20:39:33Z</dc:date>
    <item>
      <title>initialize with a user different from root</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/initialize-with-a-user-different-from-root/m-p/2920202#M109326</link>
      <description>Hello all,&lt;BR /&gt;I need help !!!&lt;BR /&gt;I created new script in /sbin/init.d to be started while the server is brought up .&lt;BR /&gt;I created links in sbin/rc2.d /sbin/rc3.d for kill and start the script/daemon &lt;BR /&gt;The problem is that I need this specific daemon to be initialize with a user different from root here is what I wrote&lt;BR /&gt;BTW if I remove the su - &lt;USER&gt;  -c (change user command) &lt;BR /&gt;The script work just fine and initialize the daemon with the root user&lt;BR /&gt;&lt;BR /&gt;  if [ -x /opt/xxx/xxx/&lt;MY_ daemon=""&gt; -a -r /opt/xxx/xxx/&lt;MY_ daemon_cfg=""&gt; ]&lt;BR /&gt;then&lt;BR /&gt;        APPD=su - &lt;MY_USER&gt; -c "/opt/xxx/xxx//&lt;MY_DAEMON&gt;  -f &lt;MY_ daemon_cfg=""&gt;"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;what is wrong with this line ?&lt;BR /&gt;Thank you ,&lt;BR /&gt;A.K&lt;/MY_&gt;&lt;/MY_DAEMON&gt;&lt;/MY_USER&gt;&lt;/MY_&gt;&lt;/MY_&gt;&lt;/USER&gt;</description>
      <pubDate>Wed, 05 Mar 2003 20:32:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/initialize-with-a-user-different-from-root/m-p/2920202#M109326</guid>
      <dc:creator>A.K.</dc:creator>
      <dc:date>2003-03-05T20:32:20Z</dc:date>
    </item>
    <item>
      <title>Re: initialize with a user different from root</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/initialize-with-a-user-different-from-root/m-p/2920203#M109327</link>
      <description>You are trying to assign the output of your su -... command to APPD. It needs to be put in execution quotes either back ticks ` (with ~ key) or with in $(). Like&lt;BR /&gt;&lt;BR /&gt;APPD=$(su - &lt;MY_USER ...="" _cfg=""&gt;")&lt;BR /&gt;&lt;BR /&gt;-Sri&lt;/MY_USER&gt;</description>
      <pubDate>Wed, 05 Mar 2003 20:37:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/initialize-with-a-user-different-from-root/m-p/2920203#M109327</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2003-03-05T20:37:21Z</dc:date>
    </item>
    <item>
      <title>Re: initialize with a user different from root</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/initialize-with-a-user-different-from-root/m-p/2920204#M109328</link>
      <description>The problem is that you are doing a su - my_user rather than a su my_user. I know that you want to invoke my_user's .profile BUT that is your problem. The .profile contains commands like tset, stty, and tabs that expect an interactive environment - which you ain't.&lt;BR /&gt;&lt;BR /&gt;The best solution is to create a script e.g. /usr/local/bin/my_user_env.sh (that contains no exit or return statements). This script will set all the environment vars and then this script is sourced (via . /usr/local/bin/my_user_env.sh) by BOTH your init.d command AND my_user's .profile. &lt;BR /&gt;&lt;BR /&gt;The less good way is to surround all the interactive commands in .profile with&lt;BR /&gt;if [ -t 0 ]&lt;BR /&gt;then&lt;BR /&gt;  tset&lt;BR /&gt;  stty ..&lt;BR /&gt;fi&lt;BR /&gt;</description>
      <pubDate>Wed, 05 Mar 2003 20:39:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/initialize-with-a-user-different-from-root/m-p/2920204#M109328</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2003-03-05T20:39:33Z</dc:date>
    </item>
  </channel>
</rss>

