<?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: Running startup scripts under different user in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/running-startup-scripts-under-different-user/m-p/3063149#M6498</link>
    <description>Oh wait don't do it in rc.local thats a pain in the butt.  Its pretty easy to write an init script and put it in /etc/init.d/ that way you can start and stop the daemon simply.&lt;BR /&gt;&lt;BR /&gt;Then make some links to it in /etc/rc2.d/&lt;BR /&gt;&lt;BR /&gt;called S99&amp;lt;scriptname&amp;gt; ( S is for start )&lt;BR /&gt;&lt;BR /&gt;and one in rc5.d/ called&lt;BR /&gt;&lt;BR /&gt;K99&amp;lt;scriptname&amp;gt; ( the k is for stop which is kind of dumb but whatever )&lt;BR /&gt;&lt;BR /&gt;The scripts in the rcN.d directorys are executed with the argument start or stop depending on their name.  At least that has been my experience.  I will attach a really simple script that I use to start my flexlm servers so you have a kind of template to work with.&lt;BR /&gt;&lt;BR /&gt;I hope that helps,&lt;BR /&gt;&lt;BR /&gt;Dave</description>
    <pubDate>Wed, 03 Sep 2003 20:22:01 GMT</pubDate>
    <dc:creator>Dave Falloon</dc:creator>
    <dc:date>2003-09-03T20:22:01Z</dc:date>
    <item>
      <title>Running startup scripts under different user</title>
      <link>https://community.hpe.com/t5/operating-system-linux/running-startup-scripts-under-different-user/m-p/3063144#M6493</link>
      <description>Hello, I'm running RedHat 8.&lt;BR /&gt;Does anyone know of a way to run a startup script in /etc/rc.d/init.d/ under a user other than root?&lt;BR /&gt;I don't think that there is any setting in the program itself or the config files for it.&lt;BR /&gt;To run it normally I just installed it using user "user1" and su to user1 to call the startup script. This way the process is owned by user1.&lt;BR /&gt;I tried creating a chkconfig compatible script in /etc/rc.d/init.d/ to start it on startup, but then it starts as root.&lt;BR /&gt;Any suggestions?&lt;BR /&gt;Thanks...&lt;BR /&gt;&lt;BR /&gt;-Travis</description>
      <pubDate>Wed, 03 Sep 2003 18:19:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/running-startup-scripts-under-different-user/m-p/3063144#M6493</guid>
      <dc:creator>tpfraz</dc:creator>
      <dc:date>2003-09-03T18:19:19Z</dc:date>
    </item>
    <item>
      <title>Re: Running startup scripts under different user</title>
      <link>https://community.hpe.com/t5/operating-system-linux/running-startup-scripts-under-different-user/m-p/3063145#M6494</link>
      <description>First you would have to allow execute permissions to users other than root.&lt;BR /&gt;&lt;BR /&gt;This is a potential security hazard.&lt;BR /&gt;&lt;BR /&gt;To change the permissions chmod o+x /etc/init.d/&lt;SCRITPNAME&gt;&lt;BR /&gt;&lt;BR /&gt;You couild change ownership on the script, but this too is a security hazard.&lt;BR /&gt;&lt;BR /&gt;Some daemon's are quite unhappy with being run by non-root users.  Some won't run at all.&lt;BR /&gt;&lt;BR /&gt;Probably the issue with what you have done thus far is permissions and ownership of the script.&lt;BR /&gt;&lt;BR /&gt;SEP&lt;/SCRITPNAME&gt;</description>
      <pubDate>Wed, 03 Sep 2003 18:38:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/running-startup-scripts-under-different-user/m-p/3063145#M6494</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2003-09-03T18:38:05Z</dc:date>
    </item>
    <item>
      <title>Re: Running startup scripts under different user</title>
      <link>https://community.hpe.com/t5/operating-system-linux/running-startup-scripts-under-different-user/m-p/3063146#M6495</link>
      <description>As root you can run anything you want as any user you want.  Here is one way:&lt;BR /&gt;&lt;BR /&gt;su - &lt;USERNAME&gt; -c "&lt;COMMAND&gt;"&lt;BR /&gt;&lt;BR /&gt;heres a runnable example:&lt;BR /&gt;&lt;BR /&gt;su - flexlm -c "lmgrd -c license.dat"&lt;BR /&gt;&lt;BR /&gt;I actually use this to run my flexlm license daemons so that the process is running as the flexlm user, ie. no shell.&lt;BR /&gt;&lt;BR /&gt;I hope that helps,&lt;BR /&gt;&lt;BR /&gt;Dave&lt;/COMMAND&gt;&lt;/USERNAME&gt;</description>
      <pubDate>Wed, 03 Sep 2003 19:01:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/running-startup-scripts-under-different-user/m-p/3063146#M6495</guid>
      <dc:creator>Dave Falloon</dc:creator>
      <dc:date>2003-09-03T19:01:13Z</dc:date>
    </item>
    <item>
      <title>Re: Running startup scripts under different user</title>
      <link>https://community.hpe.com/t5/operating-system-linux/running-startup-scripts-under-different-user/m-p/3063147#M6496</link>
      <description>It's not a matter of permissions or ownership because I can run the daemon just fine under the user that I want to. It's just getting it to start automatically under that user upon startup.&lt;BR /&gt;&lt;BR /&gt;Dave, so it sounds like I should be able to just enter the command&lt;BR /&gt;su user -c "command" for the program I want started into the rc.local file and it should run correctly.&lt;BR /&gt;Does that sound right?&lt;BR /&gt;I tried starting it on the command line that way and it works just fine.&lt;BR /&gt;&lt;BR /&gt;-Travis</description>
      <pubDate>Wed, 03 Sep 2003 19:55:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/running-startup-scripts-under-different-user/m-p/3063147#M6496</guid>
      <dc:creator>tpfraz</dc:creator>
      <dc:date>2003-09-03T19:55:30Z</dc:date>
    </item>
    <item>
      <title>Re: Running startup scripts under different user</title>
      <link>https://community.hpe.com/t5/operating-system-linux/running-startup-scripts-under-different-user/m-p/3063148#M6497</link>
      <description>Yup that is exactly what it should do.  I do it all the time.&lt;BR /&gt;&lt;BR /&gt;remember the - after the su is very important otherwise you are that user but you have not sourced that users enviroment scripts which can be bad news, ie. path will be totally on crack.&lt;BR /&gt;&lt;BR /&gt;su dave != su - dave&lt;BR /&gt;&lt;BR /&gt;Dave</description>
      <pubDate>Wed, 03 Sep 2003 20:10:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/running-startup-scripts-under-different-user/m-p/3063148#M6497</guid>
      <dc:creator>Dave Falloon</dc:creator>
      <dc:date>2003-09-03T20:10:45Z</dc:date>
    </item>
    <item>
      <title>Re: Running startup scripts under different user</title>
      <link>https://community.hpe.com/t5/operating-system-linux/running-startup-scripts-under-different-user/m-p/3063149#M6498</link>
      <description>Oh wait don't do it in rc.local thats a pain in the butt.  Its pretty easy to write an init script and put it in /etc/init.d/ that way you can start and stop the daemon simply.&lt;BR /&gt;&lt;BR /&gt;Then make some links to it in /etc/rc2.d/&lt;BR /&gt;&lt;BR /&gt;called S99&amp;lt;scriptname&amp;gt; ( S is for start )&lt;BR /&gt;&lt;BR /&gt;and one in rc5.d/ called&lt;BR /&gt;&lt;BR /&gt;K99&amp;lt;scriptname&amp;gt; ( the k is for stop which is kind of dumb but whatever )&lt;BR /&gt;&lt;BR /&gt;The scripts in the rcN.d directorys are executed with the argument start or stop depending on their name.  At least that has been my experience.  I will attach a really simple script that I use to start my flexlm servers so you have a kind of template to work with.&lt;BR /&gt;&lt;BR /&gt;I hope that helps,&lt;BR /&gt;&lt;BR /&gt;Dave</description>
      <pubDate>Wed, 03 Sep 2003 20:22:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/running-startup-scripts-under-different-user/m-p/3063149#M6498</guid>
      <dc:creator>Dave Falloon</dc:creator>
      <dc:date>2003-09-03T20:22:01Z</dc:date>
    </item>
    <item>
      <title>Re: Running startup scripts under different user</title>
      <link>https://community.hpe.com/t5/operating-system-linux/running-startup-scripts-under-different-user/m-p/3063150#M6499</link>
      <description>Okay, thanks Dave.&lt;BR /&gt;I'm pretty sure I have it working, I'll know next time I restart.&lt;BR /&gt;I already had a script in /etc/rc.d/init.d/ that would start the program but under root.&lt;BR /&gt;All that script did was call the program's respective _start or _stop scripts.&lt;BR /&gt;So I just added the "su - user" in front of each call to the start/stop scripts.&lt;BR /&gt;It works by doing &lt;BR /&gt;/etc/rc.d/init.d/program start|stop manually&lt;BR /&gt;and runs under the appropriate user so I'm pretty sure that it will works on startup.&lt;BR /&gt;I also configured the script appropriately with the S and K links.&lt;BR /&gt;Thanks a lot...&lt;BR /&gt;&lt;BR /&gt;-Travis</description>
      <pubDate>Wed, 03 Sep 2003 21:16:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/running-startup-scripts-under-different-user/m-p/3063150#M6499</guid>
      <dc:creator>tpfraz</dc:creator>
      <dc:date>2003-09-03T21:16:33Z</dc:date>
    </item>
  </channel>
</rss>

