<?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: Scripting in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/scripting/m-p/5084965#M92863</link>
    <description>What if I want to run a series of commands ?&lt;BR /&gt;</description>
    <pubDate>Wed, 19 Dec 2007 08:10:17 GMT</pubDate>
    <dc:creator>dctw</dc:creator>
    <dc:date>2007-12-19T08:10:17Z</dc:date>
    <item>
      <title>Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting/m-p/5084963#M92861</link>
      <description>Hi, I want to write a script which needs to run some commands as a different user.&lt;BR /&gt;&lt;BR /&gt;Is there a way to write the script without having to manually SU to another user first?</description>
      <pubDate>Wed, 19 Dec 2007 07:52:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting/m-p/5084963#M92861</guid>
      <dc:creator>dctw</dc:creator>
      <dc:date>2007-12-19T07:52:15Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting/m-p/5084964#M92862</link>
      <description>I've never tried this, but the first thing I would try is to put a line in the script:&lt;BR /&gt;&lt;BR /&gt;su - username -c command&lt;BR /&gt;&lt;BR /&gt;substituting username and command as appropriate. Please let us know if it works.&lt;BR /&gt;&lt;BR /&gt;Mark Syder (like the drink but spelt different)</description>
      <pubDate>Wed, 19 Dec 2007 08:08:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting/m-p/5084964#M92862</guid>
      <dc:creator>MarkSyder</dc:creator>
      <dc:date>2007-12-19T08:08:02Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting/m-p/5084965#M92863</link>
      <description>What if I want to run a series of commands ?&lt;BR /&gt;</description>
      <pubDate>Wed, 19 Dec 2007 08:10:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting/m-p/5084965#M92863</guid>
      <dc:creator>dctw</dc:creator>
      <dc:date>2007-12-19T08:10:17Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting/m-p/5084966#M92864</link>
      <description>It didn't work. I'm SU from root. It asks me for login credentials.</description>
      <pubDate>Wed, 19 Dec 2007 08:12:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting/m-p/5084966#M92864</guid>
      <dc:creator>dctw</dc:creator>
      <dc:date>2007-12-19T08:12:57Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting/m-p/5084967#M92865</link>
      <description>But are you running the script as root? What is the ownership of the script?&lt;BR /&gt;&lt;BR /&gt;If my suggestion worked, you would need a separate su line for each command.&lt;BR /&gt;&lt;BR /&gt;Mark</description>
      <pubDate>Wed, 19 Dec 2007 08:16:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting/m-p/5084967#M92865</guid>
      <dc:creator>MarkSyder</dc:creator>
      <dc:date>2007-12-19T08:16:00Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting/m-p/5084968#M92866</link>
      <description>Hi dctw,&lt;BR /&gt;&lt;BR /&gt;The same way you manually SU to another user you can do SU inside a script:&lt;BR /&gt;&lt;BR /&gt;su - $OTHER -c "cmd"&lt;BR /&gt;But you will be prompted for a password if you are NOT "root" while executing the script. &lt;BR /&gt;&lt;BR /&gt;Better may be to install "sudo" and configure user-A to be allowed to execute some cmds as user-B without password.&lt;BR /&gt;&lt;BR /&gt;sudo -u $OTHER "cmd"&lt;BR /&gt;&lt;BR /&gt;rgds&lt;BR /&gt;HGH&lt;BR /&gt;</description>
      <pubDate>Wed, 19 Dec 2007 08:16:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting/m-p/5084968#M92866</guid>
      <dc:creator>Hemmetter</dc:creator>
      <dc:date>2007-12-19T08:16:18Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting/m-p/5084969#M92867</link>
      <description>Ah... after some modification.. it's fine now...&lt;BR /&gt;&lt;BR /&gt;Thank you so much.&lt;BR /&gt;&lt;BR /&gt;So how do I run a series of commands as a diffferent user?</description>
      <pubDate>Wed, 19 Dec 2007 08:16:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting/m-p/5084969#M92867</guid>
      <dc:creator>dctw</dc:creator>
      <dc:date>2007-12-19T08:16:34Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting/m-p/5084970#M92868</link>
      <description>How many commands are in a series? If two or three, do a line with su for each. If more than this, it may be worth putting them in a separate script and making your main script run that on the line with su.&lt;BR /&gt;&lt;BR /&gt;Mark</description>
      <pubDate>Wed, 19 Dec 2007 08:19:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting/m-p/5084970#M92868</guid>
      <dc:creator>MarkSyder</dc:creator>
      <dc:date>2007-12-19T08:19:42Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting/m-p/5084971#M92869</link>
      <description>&amp;gt;So how do I run a series of commands as a different user?&lt;BR /&gt;&lt;BR /&gt;Either use a script as Mark suggested or you can use ";" to separate commands.  Or you can use newlines:&lt;BR /&gt;su - $OTHER -c "cmd1&lt;BR /&gt;cmd2&lt;BR /&gt;cmd3"</description>
      <pubDate>Wed, 19 Dec 2007 08:57:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting/m-p/5084971#M92869</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-12-19T08:57:13Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting/m-p/5084972#M92870</link>
      <description>su - user -c command&lt;BR /&gt;&lt;BR /&gt;Thank you guys so much for the help.</description>
      <pubDate>Wed, 19 Dec 2007 09:03:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting/m-p/5084972#M92870</guid>
      <dc:creator>dctw</dc:creator>
      <dc:date>2007-12-19T09:03:21Z</dc:date>
    </item>
  </channel>
</rss>

