<?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 Stop user login in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/stop-user-login/m-p/5054902#M435522</link>
    <description>Hi Admins,&lt;BR /&gt;&lt;BR /&gt;I want to lock out all but three users (root, admin1 and admin2) from a system during a maintenance window.&lt;BR /&gt;&lt;BR /&gt;I have considered using the NOLOGIN=1 in /etc/default/security and /etc/nologin .  Since I cannot allow admin1 and admin2 to login when this has been set I have ruled it out.&lt;BR /&gt;&lt;BR /&gt;My current plan was to use following script in /etc/profile&lt;BR /&gt;&lt;BR /&gt;user=`whoami`&lt;BR /&gt;if [ $user != root ]  -o [ $user != admin1 ]  -o  [ $user != admin2 ]  &lt;BR /&gt;then&lt;BR /&gt;echo "System is currently undergoing maintenance"&lt;BR /&gt;exit&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;However the test is not behaving as I thought it would. Can somebody please help me with my code or suggest an alternative solution?&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;</description>
    <pubDate>Mon, 25 Jun 2007 23:21:19 GMT</pubDate>
    <dc:creator>John Mak</dc:creator>
    <dc:date>2007-06-25T23:21:19Z</dc:date>
    <item>
      <title>Stop user login</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/stop-user-login/m-p/5054902#M435522</link>
      <description>Hi Admins,&lt;BR /&gt;&lt;BR /&gt;I want to lock out all but three users (root, admin1 and admin2) from a system during a maintenance window.&lt;BR /&gt;&lt;BR /&gt;I have considered using the NOLOGIN=1 in /etc/default/security and /etc/nologin .  Since I cannot allow admin1 and admin2 to login when this has been set I have ruled it out.&lt;BR /&gt;&lt;BR /&gt;My current plan was to use following script in /etc/profile&lt;BR /&gt;&lt;BR /&gt;user=`whoami`&lt;BR /&gt;if [ $user != root ]  -o [ $user != admin1 ]  -o  [ $user != admin2 ]  &lt;BR /&gt;then&lt;BR /&gt;echo "System is currently undergoing maintenance"&lt;BR /&gt;exit&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;However the test is not behaving as I thought it would. Can somebody please help me with my code or suggest an alternative solution?&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;</description>
      <pubDate>Mon, 25 Jun 2007 23:21:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/stop-user-login/m-p/5054902#M435522</guid>
      <dc:creator>John Mak</dc:creator>
      <dc:date>2007-06-25T23:21:19Z</dc:date>
    </item>
    <item>
      <title>Re: Stop user login</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/stop-user-login/m-p/5054903#M435523</link>
      <description>As usual, it might help to know what&lt;BR /&gt;happened.  ("[N]ot behaving as I thought it&lt;BR /&gt;would" is not as informative as you might&lt;BR /&gt;think.)  I'll assume that it prints out the&lt;BR /&gt;message for the low-class users, and then&lt;BR /&gt;continues as if nothing were special.  I'd&lt;BR /&gt;guess that that's because "exit" in a script&lt;BR /&gt;like this is what happens normally.  Perhaps&lt;BR /&gt;"logout", or "kill -HUP 0", or something&lt;BR /&gt;comparably vicious (depending on the shell)&lt;BR /&gt;would do something new and different.</description>
      <pubDate>Tue, 26 Jun 2007 00:32:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/stop-user-login/m-p/5054903#M435523</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2007-06-26T00:32:45Z</dc:date>
    </item>
    <item>
      <title>Re: Stop user login</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/stop-user-login/m-p/5054904#M435524</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Exit is working as expected. Itâ  s the test for the if statement thatâ  s not working. &lt;BR /&gt;&lt;BR /&gt;It only checks the first condition[ $user != root ] and does not consider the second or third test.&lt;BR /&gt;&lt;BR /&gt;From my interpretation it should read&lt;BR /&gt;&lt;BR /&gt;If $user not equal to root OR $user not equal to admin1 OR $user not equal to admin2&lt;BR /&gt;# at this point it only checks the first test&lt;BR /&gt;then&lt;BR /&gt;echo "System is currently undergoing maintenance"&lt;BR /&gt;exit&lt;BR /&gt;fi&lt;BR /&gt;</description>
      <pubDate>Tue, 26 Jun 2007 00:54:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/stop-user-login/m-p/5054904#M435524</guid>
      <dc:creator>John Mak</dc:creator>
      <dc:date>2007-06-26T00:54:04Z</dc:date>
    </item>
    <item>
      <title>Re: Stop user login</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/stop-user-login/m-p/5054905#M435525</link>
      <description>&lt;!--!*#--&gt;Your condition is wrong.  You will allow NOBODY to login!&lt;BR /&gt;&lt;BR /&gt;The correct logic is:&lt;BR /&gt;if [ $user != root ] -a [ $user != admin1 ] -a [ $user != admin2 ]; then&lt;BR /&gt;&lt;BR /&gt;Or better yet if you have problems with boolean arithmetic:  ;-)&lt;BR /&gt;if [ $user = root ] -o [ $user = admin1 ] -o [ $user != admin2 ]; then&lt;BR /&gt;   : # allow VIPs&lt;BR /&gt;else&lt;BR /&gt;   echo "System is currently undergoing maintenance"&lt;BR /&gt;   exit&lt;BR /&gt;fi</description>
      <pubDate>Tue, 26 Jun 2007 01:37:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/stop-user-login/m-p/5054905#M435525</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-06-26T01:37:26Z</dc:date>
    </item>
    <item>
      <title>Re: Stop user login</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/stop-user-login/m-p/5054906#M435526</link>
      <description>&lt;!--!*#--&gt;Oops, that's:&lt;BR /&gt;Your condition is wrong.  You will allow NOBODY to login!&lt;BR /&gt;&lt;BR /&gt;The correct logic is:&lt;BR /&gt;if [ $user != root -a $user != admin1 -a $user != admin2 ]; then&lt;BR /&gt;&lt;BR /&gt;Or better yet if you have problems with boolean arithmetic:  ;-)&lt;BR /&gt;if [ $user = root -o $user = admin1 -o $user != admin2 ]; then&lt;BR /&gt;   : # allow VIPs&lt;BR /&gt;else&lt;BR /&gt;   echo "System is currently undergoing maintenance"&lt;BR /&gt;   exit&lt;BR /&gt;fi</description>
      <pubDate>Tue, 26 Jun 2007 01:40:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/stop-user-login/m-p/5054906#M435526</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-06-26T01:40:41Z</dc:date>
    </item>
    <item>
      <title>Re: Stop user login</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/stop-user-login/m-p/5054907#M435527</link>
      <description>You guys rock!&lt;BR /&gt;&lt;BR /&gt;If anyone is interested this is the final product&lt;BR /&gt;&lt;BR /&gt;user=`whoami`&lt;BR /&gt;if [ $user != root -a $user != admin1 -a $user != admin2 ]&lt;BR /&gt;then&lt;BR /&gt;echo "System is currently undergoing maintenance"&lt;BR /&gt;exit&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Thanks for the help.&lt;BR /&gt;</description>
      <pubDate>Tue, 26 Jun 2007 18:48:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/stop-user-login/m-p/5054907#M435527</guid>
      <dc:creator>John Mak</dc:creator>
      <dc:date>2007-06-26T18:48:55Z</dc:date>
    </item>
    <item>
      <title>Re: Stop user login</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/stop-user-login/m-p/5054908#M435528</link>
      <description>Double oops:&lt;BR /&gt;Or better yet if you have problems with boolean arithmetic:  ;-)&lt;BR /&gt;if [ $user = root -o $user = admin1 -o $user = admin2 ]; then&lt;BR /&gt;</description>
      <pubDate>Tue, 26 Jun 2007 19:53:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/stop-user-login/m-p/5054908#M435528</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-06-26T19:53:16Z</dc:date>
    </item>
  </channel>
</rss>

