<?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: Limiting user logon and always running script as root in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/limiting-user-logon-and-always-running-script-as-root/m-p/2495164#M20024</link>
    <description>Another possible solution is to specify the script as the user's login shell in the /etc/passwd file.  For example:&lt;BR /&gt;&lt;BR /&gt;guest1::26669:66:Guest1:/home/guest1:/bin/guestscript&lt;BR /&gt;&lt;BR /&gt;Then you'll have to add the script pathname to the /etc/shells file so that login will recognize it as a valid login shell...&lt;BR /&gt;&lt;BR /&gt;/etc/shells:&lt;BR /&gt;/sbin/sh&lt;BR /&gt;/bin/sh&lt;BR /&gt;/bin/csh&lt;BR /&gt;/bin/ksh&lt;BR /&gt;/bin/guestscript&lt;BR /&gt;&lt;BR /&gt;When the user logs in, the login process forc/execs the script.  When the script exits, the login session is terminated.&lt;BR /&gt;&lt;BR /&gt;To make the script execute with root permission, make it owned by root and turn on the setuid bit...&lt;BR /&gt;&lt;BR /&gt;chown root /bin/guestscript&lt;BR /&gt;chmod +s   /bin/guestscript&lt;BR /&gt;&lt;BR /&gt;-sam</description>
    <pubDate>Fri, 16 Feb 2001 23:52:16 GMT</pubDate>
    <dc:creator>Sam Nicholls</dc:creator>
    <dc:date>2001-02-16T23:52:16Z</dc:date>
    <item>
      <title>Limiting user logon and always running script as root</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/limiting-user-logon-and-always-running-script-as-root/m-p/2495162#M20022</link>
      <description>Hey Gang, &lt;BR /&gt;&lt;BR /&gt;This is a two fold question which, hopefully, is not too tough.&lt;BR /&gt;&lt;BR /&gt;First, I want to set a user up so that ...&lt;BR /&gt;&lt;BR /&gt;a) His root directory is the home/username directory.  I tried adding the "home/username/./:" to the /etc/passwd file, but it does not work.  I want the user limited to his directory and subdirectories ONLY.&lt;BR /&gt;&lt;BR /&gt;b) If possible, I would also like to limit this user to being able to do nothing but login, run a script, see the input from the script and  enter "yes" or "no" to a prompt.  Nothing else.&lt;BR /&gt;&lt;BR /&gt;Second ...&lt;BR /&gt;I would like the script he starts to run as root, although the non-root user account needs to start the script and he needs (obviously) LESS than root permissions.&lt;BR /&gt;&lt;BR /&gt;Thanks again for all the help!&lt;BR /&gt;Mike</description>
      <pubDate>Fri, 16 Feb 2001 23:02:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/limiting-user-logon-and-always-running-script-as-root/m-p/2495162#M20022</guid>
      <dc:creator>Mike Rightmire</dc:creator>
      <dc:date>2001-02-16T23:02:24Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting user logon and always running script as root</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/limiting-user-logon-and-always-running-script-as-root/m-p/2495163#M20023</link>
      <description>Couple of ideas.  You can force the user to run a restricted shell, /usr/bin/rsh, when the user is in a restricted shell they cannot change directories, environment variables etc.  As far as the script you can change the last line in .profile to exec "script name" and that will execute the script.  To run is as root you will have to SUID it which is not wise but if you have to you have to.&lt;BR /&gt;&lt;BR /&gt;Hope This Helps!&lt;BR /&gt;&lt;BR /&gt;Rob</description>
      <pubDate>Fri, 16 Feb 2001 23:25:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/limiting-user-logon-and-always-running-script-as-root/m-p/2495163#M20023</guid>
      <dc:creator>Rob Smith</dc:creator>
      <dc:date>2001-02-16T23:25:43Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting user logon and always running script as root</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/limiting-user-logon-and-always-running-script-as-root/m-p/2495164#M20024</link>
      <description>Another possible solution is to specify the script as the user's login shell in the /etc/passwd file.  For example:&lt;BR /&gt;&lt;BR /&gt;guest1::26669:66:Guest1:/home/guest1:/bin/guestscript&lt;BR /&gt;&lt;BR /&gt;Then you'll have to add the script pathname to the /etc/shells file so that login will recognize it as a valid login shell...&lt;BR /&gt;&lt;BR /&gt;/etc/shells:&lt;BR /&gt;/sbin/sh&lt;BR /&gt;/bin/sh&lt;BR /&gt;/bin/csh&lt;BR /&gt;/bin/ksh&lt;BR /&gt;/bin/guestscript&lt;BR /&gt;&lt;BR /&gt;When the user logs in, the login process forc/execs the script.  When the script exits, the login session is terminated.&lt;BR /&gt;&lt;BR /&gt;To make the script execute with root permission, make it owned by root and turn on the setuid bit...&lt;BR /&gt;&lt;BR /&gt;chown root /bin/guestscript&lt;BR /&gt;chmod +s   /bin/guestscript&lt;BR /&gt;&lt;BR /&gt;-sam</description>
      <pubDate>Fri, 16 Feb 2001 23:52:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/limiting-user-logon-and-always-running-script-as-root/m-p/2495164#M20024</guid>
      <dc:creator>Sam Nicholls</dc:creator>
      <dc:date>2001-02-16T23:52:16Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting user logon and always running script as root</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/limiting-user-logon-and-always-running-script-as-root/m-p/2495165#M20025</link>
      <description>Dear Rob and Sam, &lt;BR /&gt;&lt;BR /&gt;Thanks for the great advice!  You are both right on target, however (unfortunately) you both got me half way there...and your answers SEEM to be mutually exclusive.&lt;BR /&gt;&lt;BR /&gt;I tried the rsh option, which worked fantastic for limiting the user, however for some reason it refuses to allow me to run the script.&lt;BR /&gt;&lt;BR /&gt;The script is running a command that can only be run by root, and needs to create logfiles in other directories.  I have the suid set so the command will run if the user is logged in with a regular shell and, I tried having the logfiles created in the restricted user's home directory, but the issue seems to be with the command which can only be run as root.  It does not want to run if invoked from the restricted shell.&lt;BR /&gt;&lt;BR /&gt;I also tried changing the passwd file so the script runs as the shell when the user logs on, but all I get when logging the user on is a "no shell" error.  I tried to add the path to the /etc/shells file (which did not exist, so I created it) but that did not work either.  As this is HP-UX 10.20, I wonder if there is not a "shells" file which it looks to so that would work.&lt;BR /&gt;&lt;BR /&gt;So, we are about half way there.  Any other suggestions to either get the above issues resolved, or a different route to the end result?&lt;BR /&gt;&lt;BR /&gt;Thanks again!&lt;BR /&gt;Mike</description>
      <pubDate>Tue, 20 Feb 2001 17:09:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/limiting-user-logon-and-always-running-script-as-root/m-p/2495165#M20025</guid>
      <dc:creator>Mike Rightmire</dc:creator>
      <dc:date>2001-02-20T17:09:55Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting user logon and always running script as root</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/limiting-user-logon-and-always-running-script-as-root/m-p/2495166#M20026</link>
      <description>You could use sudo to do this.  Sudo allows you to set users up to run things with root privilege without actually giving out the root password.  You can download sudo at &lt;A href="http://hpux.cs.utah.edu/hppd/hpux/Sysadmin/sudo-1.6.2b1/" target="_blank"&gt;http://hpux.cs.utah.edu/hppd/hpux/Sysadmin/sudo-1.6.2b1/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;What you can do with this is have the users shell set the restricted shell.  Then have sudo set up so that the user can run the script.  At the shell prompt the user would enter 'sudo scriptname'.&lt;BR /&gt;&lt;BR /&gt;Another option would be to set up the .profile so that it will do an "exec sudo scriptname" and that way when the user gets done with the script the login will be terminated.</description>
      <pubDate>Tue, 20 Feb 2001 17:22:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/limiting-user-logon-and-always-running-script-as-root/m-p/2495166#M20026</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2001-02-20T17:22:00Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting user logon and always running script as root</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/limiting-user-logon-and-always-running-script-as-root/m-p/2495167#M20027</link>
      <description>Hmmm...OK.  I got it to work, but I can't explain something.  Maybe you can help.&lt;BR /&gt;&lt;BR /&gt;I looked into SUDO, which looks like a fantastic solution, however I still need to play with it to see if I can get it functioning.&lt;BR /&gt;&lt;BR /&gt;I DID manage to get the script to run as the logon shell, which works exactly for what I need, however...I was not able to get it to function by editing the passwd file.&lt;BR /&gt;&lt;BR /&gt;When I changed the logon script in the /etc/passwd file to /home/username/scriptname, and then tried to logon, I got a 'no shell' error.&lt;BR /&gt;&lt;BR /&gt;If I went into SAM, removed the account, recreated the account (exactly the same) and placed the /home/username/scriptname THROUGH SAM as the logon shell, it worked great.&lt;BR /&gt;&lt;BR /&gt;Any explanations??!&lt;BR /&gt;&lt;BR /&gt;Thanks though for all the help!  I got it to work!&lt;BR /&gt;Mike</description>
      <pubDate>Tue, 20 Feb 2001 19:48:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/limiting-user-logon-and-always-running-script-as-root/m-p/2495167#M20027</guid>
      <dc:creator>Mike Rightmire</dc:creator>
      <dc:date>2001-02-20T19:48:23Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting user logon and always running script as root</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/limiting-user-logon-and-always-running-script-as-root/m-p/2495168#M20028</link>
      <description>Mike,&lt;BR /&gt;&lt;BR /&gt;Has your system been converted to trusted?  I don't really understand why it worked via SAM but not via direct editing of /etc/passwd and /etc/shells.  On my non-trusted, 10.20 system, I was able to do it just like I detailed in my first reply.&lt;BR /&gt;&lt;BR /&gt;Maybe on trusted systems there is additional magic that must be done and SAM does it automatically.  Now that the magic appears to have been done, you may be able to add/modify additional users be editing /etc/passwd.&lt;BR /&gt;&lt;BR /&gt;-sam</description>
      <pubDate>Tue, 20 Feb 2001 23:20:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/limiting-user-logon-and-always-running-script-as-root/m-p/2495168#M20028</guid>
      <dc:creator>Sam Nicholls</dc:creator>
      <dc:date>2001-02-20T23:20:12Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting user logon and always running script as root</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/limiting-user-logon-and-always-running-script-as-root/m-p/2495169#M20029</link>
      <description>Hey Sam, &lt;BR /&gt;&lt;BR /&gt;I really can't answer the question of whether the system has been converted to trusted, as I really just inherited them.&lt;BR /&gt;&lt;BR /&gt;How would I check?</description>
      <pubDate>Wed, 21 Feb 2001 19:24:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/limiting-user-logon-and-always-running-script-as-root/m-p/2495169#M20029</guid>
      <dc:creator>Mike Rightmire</dc:creator>
      <dc:date>2001-02-21T19:24:43Z</dc:date>
    </item>
  </channel>
</rss>

