<?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: Run a command as user without password in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/run-a-command-as-user-without-password/m-p/3524198#M745514</link>
    <description>Prepare a script that will run&lt;BR /&gt;user2's profile&lt;BR /&gt;user2 command&lt;BR /&gt;&lt;BR /&gt;Call it xxx, run this xx through sudo&lt;BR /&gt;&lt;BR /&gt;Anil</description>
    <pubDate>Wed, 13 Apr 2005 10:49:12 GMT</pubDate>
    <dc:creator>RAC_1</dc:creator>
    <dc:date>2005-04-13T10:49:12Z</dc:date>
    <item>
      <title>Run a command as user without password</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/run-a-command-as-user-without-password/m-p/3524196#M745512</link>
      <description>Hi folks,&lt;BR /&gt;&lt;BR /&gt;One of my users (USER1) needs to run a command that belongs to USER2.  The problem is that before the command is run, the profile for USER2 has to be run.  I realize that su - USER2 -c "command" could work, but it is being run from a batch file and therefore prompting for a password is no good.  "su" doesn't seem to have a switch to hard code the password.  On the other hand SUDO will run the command with the -S switch allowing for the password, but SUDO will not run the .profile of USER2 and I read in another forum that it is not possible either with SUDO.  So any ideas on how I can run the profile of USER2, run the command, and pass the password in a batch file?&lt;BR /&gt;&lt;BR /&gt;Thanks!</description>
      <pubDate>Wed, 13 Apr 2005 10:44:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/run-a-command-as-user-without-password/m-p/3524196#M745512</guid>
      <dc:creator>Coolmar</dc:creator>
      <dc:date>2005-04-13T10:44:25Z</dc:date>
    </item>
    <item>
      <title>Re: Run a command as user without password</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/run-a-command-as-user-without-password/m-p/3524197#M745513</link>
      <description>The only user that can do what you wish is root.&lt;BR /&gt;&lt;BR /&gt;Its obvious why you don't want to use root.&lt;BR /&gt;&lt;BR /&gt;The other solution is to take the command that user2 owns and put it in a common area like /usr/contrib/bin&lt;BR /&gt;&lt;BR /&gt;There permnissions can be set to allow user1 to run the command.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Wed, 13 Apr 2005 10:46:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/run-a-command-as-user-without-password/m-p/3524197#M745513</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2005-04-13T10:46:45Z</dc:date>
    </item>
    <item>
      <title>Re: Run a command as user without password</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/run-a-command-as-user-without-password/m-p/3524198#M745514</link>
      <description>Prepare a script that will run&lt;BR /&gt;user2's profile&lt;BR /&gt;user2 command&lt;BR /&gt;&lt;BR /&gt;Call it xxx, run this xx through sudo&lt;BR /&gt;&lt;BR /&gt;Anil</description>
      <pubDate>Wed, 13 Apr 2005 10:49:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/run-a-command-as-user-without-password/m-p/3524198#M745514</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2005-04-13T10:49:12Z</dc:date>
    </item>
    <item>
      <title>Re: Run a command as user without password</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/run-a-command-as-user-without-password/m-p/3524199#M745515</link>
      <description>Probably the least evil way to accomplish this is via sudo. Although you think you need to include a the user's .profile, I submit that you do not because almost all .profile's in HP-UX contain commands that deal with terminals (stty, tset, tabs) that will hang when stdin is not a terminal.&lt;BR /&gt;Here is what i would do. Create a file (e.g. /usr/local/bin/USER2env.sh) that sets and exports any needed environment variables. This file must not contain an exit or return statement. Next, alter USER2's .profile and remove all the environment variables you set in /usr/local/bin/USER2env.sh and insert this single line:&lt;BR /&gt;. /usr/local/bin/USER2env.sh&lt;BR /&gt;&lt;BR /&gt;and also insert the same line in your batch script. The "." command sources the file for both USER2's .profile and your command and everyone is happy.&lt;BR /&gt;</description>
      <pubDate>Wed, 13 Apr 2005 10:55:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/run-a-command-as-user-without-password/m-p/3524199#M745515</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2005-04-13T10:55:15Z</dc:date>
    </item>
    <item>
      <title>Re: Run a command as user without password</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/run-a-command-as-user-without-password/m-p/3524200#M745516</link>
      <description>Thanks everyone.  I will try your suggestions.</description>
      <pubDate>Wed, 13 Apr 2005 14:09:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/run-a-command-as-user-without-password/m-p/3524200#M745516</guid>
      <dc:creator>Coolmar</dc:creator>
      <dc:date>2005-04-13T14:09:01Z</dc:date>
    </item>
  </channel>
</rss>

