<?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: How to su thru shell scripts? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-su-thru-shell-scripts/m-p/2437944#M768574</link>
    <description>Mahesh:&lt;BR /&gt;&lt;BR /&gt;With regard to the use of 'su' in a script, if you are root, of course, you can use the 'su -' form and no password is required.  For non-root scripts, while you can su to another account within a script, you will not be able to use a stored password.  The user of the script will have to interact through his/her terminal to provide the password.  Your script can, however, check the exit status of the su call, and so determine when/whether a good transition to the new user was made.&lt;BR /&gt;&lt;BR /&gt;With regard to your FTP problem, you must, of course, have an FTP client running on your PC.&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
    <pubDate>Sat, 19 Aug 2000 12:55:10 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2000-08-19T12:55:10Z</dc:date>
    <item>
      <title>How to su thru shell scripts?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-su-thru-shell-scripts/m-p/2437943#M768573</link>
      <description>How can I change user id using shell scripts. How do I supply the password thru the script , say if I have the password stored in a variable? &lt;BR /&gt;Also if I try to ftp from unix to my local disk (giving my machine's IPaddress) it says connection refused. Do I need to change some permissions somewhere?&lt;BR /&gt;Thanx</description>
      <pubDate>Sat, 19 Aug 2000 11:22:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-su-thru-shell-scripts/m-p/2437943#M768573</guid>
      <dc:creator>Mahesh_3</dc:creator>
      <dc:date>2000-08-19T11:22:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to su thru shell scripts?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-su-thru-shell-scripts/m-p/2437944#M768574</link>
      <description>Mahesh:&lt;BR /&gt;&lt;BR /&gt;With regard to the use of 'su' in a script, if you are root, of course, you can use the 'su -' form and no password is required.  For non-root scripts, while you can su to another account within a script, you will not be able to use a stored password.  The user of the script will have to interact through his/her terminal to provide the password.  Your script can, however, check the exit status of the su call, and so determine when/whether a good transition to the new user was made.&lt;BR /&gt;&lt;BR /&gt;With regard to your FTP problem, you must, of course, have an FTP client running on your PC.&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Sat, 19 Aug 2000 12:55:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-su-thru-shell-scripts/m-p/2437944#M768574</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2000-08-19T12:55:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to su thru shell scripts?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-su-thru-shell-scripts/m-p/2437945#M768575</link>
      <description>I don't believe you can either su or newgrp from within a script.  But you can automate a login, like ftp, with a .netrc file.  For example, set up a ftpuser account and modify the .netrc file, add the appropritate commands that deposit files, for instance, and exit.</description>
      <pubDate>Sat, 19 Aug 2000 22:21:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-su-thru-shell-scripts/m-p/2437945#M768575</guid>
      <dc:creator>Michael Steele_1</dc:creator>
      <dc:date>2000-08-19T22:21:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to su thru shell scripts?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-su-thru-shell-scripts/m-p/2437946#M768576</link>
      <description>If your script is owned by root, it is not a problem. If you want another user (except root) to have rights to execute someone else commands, I guess, the easiest way is to setup the secondary group. e.g. user1 belongs to group1 and to execute oracle stuff, user1 has dba as a secondary group. Play a little bit with permissions and setup the correct PATH in your script, and you are all set! Do not forget for secondary group to create the link ln -s /etc/group /etc/logingroup. &lt;BR /&gt;Using .netrc in user's  home directory could be a security hole. Depends on the environment. &lt;BR /&gt;Using suid or sticky bit (s or t permission) could help you as well, depends in what you try to achieve.&lt;BR /&gt;For ftp, well, could be lots. What machine (OS, I mean) is your topdesk?  Can you ftp from your topdesk to Unix? Try nslookup on Unix side to ensure the name resolution is corectly solved. Edit fptd line in /etc/inetd.conf to log ftp ( ftpd -l); recycle inetd daemon (inetd -c). See the error logged in /var/adm/syslog/syslog.log file.&lt;BR /&gt;See the other posts about ftp were lots of discutions.&lt;BR /&gt;Good luck.</description>
      <pubDate>Sun, 20 Aug 2000 00:41:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-su-thru-shell-scripts/m-p/2437946#M768576</guid>
      <dc:creator>Antoanetta Naghiu</dc:creator>
      <dc:date>2000-08-20T00:41:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to su thru shell scripts?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-su-thru-shell-scripts/m-p/2437947#M768577</link>
      <description>Running the script as root and then doing an 'su -' will achive the results you are looking for. If running the script as a user and need to run as root, I would suggest something like 'sudo' which will run as root. Fom here you could 'su -' to another user if you wanted but I would be weary of all the different 'su's in a script.</description>
      <pubDate>Mon, 21 Aug 2000 03:56:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-su-thru-shell-scripts/m-p/2437947#M768577</guid>
      <dc:creator>Rick Garland</dc:creator>
      <dc:date>2000-08-21T03:56:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to su thru shell scripts?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-su-thru-shell-scripts/m-p/2437948#M768578</link>
      <description>I'm wondering if Expect could be used in this situation.</description>
      <pubDate>Mon, 21 Aug 2000 15:11:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-su-thru-shell-scripts/m-p/2437948#M768578</guid>
      <dc:creator>George LaSalle</dc:creator>
      <dc:date>2000-08-21T15:11:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to su thru shell scripts?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-su-thru-shell-scripts/m-p/2437949#M768579</link>
      <description>Yes, expect is a good answer for your problem. It will allow you to send the password without even setting a variable, or from a variable too.&lt;BR /&gt;&lt;BR /&gt;the syntax is something like the following:&lt;BR /&gt;&lt;BR /&gt;spawn "su -"&lt;BR /&gt;expect "Password:"&lt;BR /&gt;send "&lt;LETMEIN&gt;"&lt;BR /&gt;&lt;BR /&gt;You may have to terminate each line with a semi-colon (;) I can't get to my script to verify right now. You have to have expect installed in order for this to work, I think it is part of the TKL stuff.&lt;BR /&gt;&lt;/LETMEIN&gt;</description>
      <pubDate>Mon, 21 Aug 2000 20:38:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-su-thru-shell-scripts/m-p/2437949#M768579</guid>
      <dc:creator>Jeremiah Campbell</dc:creator>
      <dc:date>2000-08-21T20:38:22Z</dc:date>
    </item>
  </channel>
</rss>

