<?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: limit user login in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/limit-user-login/m-p/2759399#M831328</link>
    <description>Hi Claudio&lt;BR /&gt;&lt;BR /&gt;This is what can be done:&lt;BR /&gt;&lt;BR /&gt;edit /etc/profile&lt;BR /&gt;&lt;BR /&gt;and put this lines in there:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;loginid=`who am i | awk '{print $1}'`&lt;BR /&gt;export B=`who | grep loginid | wc -l` &lt;BR /&gt;if [ $B -gt 5 ]&lt;BR /&gt;then &lt;BR /&gt;exit&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;this will allow only 5 users to login with that id.&lt;BR /&gt;&lt;BR /&gt;Manoj Srivastava&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Mon, 08 Jul 2002 15:04:27 GMT</pubDate>
    <dc:creator>MANOJ SRIVASTAVA</dc:creator>
    <dc:date>2002-07-08T15:04:27Z</dc:date>
    <item>
      <title>limit user login</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/limit-user-login/m-p/2759395#M831324</link>
      <description>Hi All!&lt;BR /&gt; we use Baan ERP on UX11.00. Each login (on Baan) generate one user process (called bshell). From Baan, we can't limit number of user login for specific user.&lt;BR /&gt;We can try to limit number of user login, limiting number of bshell process that exist on UNIX.&lt;BR /&gt;How can I limit number of user login using - for example - script shell?&lt;BR /&gt;Thanx.</description>
      <pubDate>Mon, 08 Jul 2002 14:32:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/limit-user-login/m-p/2759395#M831324</guid>
      <dc:creator>Vogra</dc:creator>
      <dc:date>2002-07-08T14:32:29Z</dc:date>
    </item>
    <item>
      <title>Re: limit user login</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/limit-user-login/m-p/2759396#M831325</link>
      <description>Hi I limit logins by adding the number of logins permitted into the message area (field 5) of the /etc/passwd entries for each user (our field r looks like this - Doug Green,Mr,IT_TEAM,5 so this user is limited to 5 ksh sessions).&lt;BR /&gt;&lt;BR /&gt;I then added the following to a seperate profile called by the initial login profile.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;USER=$(whoami)                                                                  &lt;BR /&gt;echo $USER|egrep -q '(informix|dba)'                                            &lt;BR /&gt;if [ ! $? -eq 0 ]                                                               &lt;BR /&gt;then                                                                            &lt;BR /&gt;trap "exec exit" INT                                                            &lt;BR /&gt;TMPLOG=/tmp/login_limit.tmp                                                     &lt;BR /&gt;DATE=$(date)                                                                    &lt;BR /&gt;LIMIT=$(grep ^$USER: /etc/passwd|cut -d":" -f5|cut -d"," -f4)                   &lt;BR /&gt;COUNT=$(ps -fu"$USER"|grep "$USER"|grep "\-ksh"|grep -v grep|wc -l)             &lt;BR /&gt;        if [ $LIMIT -o $LIMIT -ne 0 ]                                           &lt;BR /&gt;        then                                                                    &lt;BR /&gt;        if [ $COUNT -gt $LIMIT ]                                                &lt;BR /&gt;        then                                                                    &lt;BR /&gt;        echo "Sorry you are only allowed $LIMIT session(s) - Press Enter \c"    &lt;BR /&gt;        read NOTHING                                                            &lt;BR /&gt;        echo "$DATE - $USER with $COUNT shells active tried to exceed $LIMIT ses&lt;BR /&gt;sions" &amp;gt;&amp;gt; $TMPLOG                                                               &lt;BR /&gt;        ps -fu"$USER"|grep "$USER"|grep -v grep &amp;gt;&amp;gt; $TMPLOG                      &lt;BR /&gt;        exit                                                                    &lt;BR /&gt;        fi                                                                      &lt;BR /&gt;        fi                                                                      &lt;BR /&gt;fi</description>
      <pubDate>Mon, 08 Jul 2002 14:40:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/limit-user-login/m-p/2759396#M831325</guid>
      <dc:creator>Nick Wickens</dc:creator>
      <dc:date>2002-07-08T14:40:24Z</dc:date>
    </item>
    <item>
      <title>Re: limit user login</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/limit-user-login/m-p/2759397#M831326</link>
      <description>Check the following&lt;BR /&gt;&lt;BR /&gt;Put the following code in /etc/profile(at the end)&lt;BR /&gt;user_name=`who -u |grep "your_user_name"`&lt;BR /&gt;&lt;BR /&gt;if [$LOGNAME = $user_name]&lt;BR /&gt;exit 0&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;What I am doing with above code is checking exisinting login and if it matches with incming login it will logout.&lt;BR /&gt;&lt;BR /&gt;Regards,</description>
      <pubDate>Mon, 08 Jul 2002 14:43:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/limit-user-login/m-p/2759397#M831326</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2002-07-08T14:43:30Z</dc:date>
    </item>
    <item>
      <title>Re: limit user login</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/limit-user-login/m-p/2759398#M831327</link>
      <description>Nick and Anil,&lt;BR /&gt;&lt;BR /&gt; The users don't execute /etc/profile or .profile.&lt;BR /&gt;The users connect on Baan from WIN95 clients that connect to Baan on Unix and in it, check the /etc/passwd.&lt;BR /&gt;</description>
      <pubDate>Mon, 08 Jul 2002 14:52:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/limit-user-login/m-p/2759398#M831327</guid>
      <dc:creator>Vogra</dc:creator>
      <dc:date>2002-07-08T14:52:46Z</dc:date>
    </item>
    <item>
      <title>Re: limit user login</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/limit-user-login/m-p/2759399#M831328</link>
      <description>Hi Claudio&lt;BR /&gt;&lt;BR /&gt;This is what can be done:&lt;BR /&gt;&lt;BR /&gt;edit /etc/profile&lt;BR /&gt;&lt;BR /&gt;and put this lines in there:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;loginid=`who am i | awk '{print $1}'`&lt;BR /&gt;export B=`who | grep loginid | wc -l` &lt;BR /&gt;if [ $B -gt 5 ]&lt;BR /&gt;then &lt;BR /&gt;exit&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;this will allow only 5 users to login with that id.&lt;BR /&gt;&lt;BR /&gt;Manoj Srivastava&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 08 Jul 2002 15:04:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/limit-user-login/m-p/2759399#M831328</guid>
      <dc:creator>MANOJ SRIVASTAVA</dc:creator>
      <dc:date>2002-07-08T15:04:27Z</dc:date>
    </item>
    <item>
      <title>Re: limit user login</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/limit-user-login/m-p/2759400#M831329</link>
      <description>do while true&lt;BR /&gt;bann_count=`ps -ef|grep [b]shell|awk '{print $2}'`&lt;BR /&gt;&lt;BR /&gt;bann_count2=ps -ef|grep [b]shell|awk '{print $2}'` &amp;gt; /tmp/bann.test&lt;BR /&gt;&lt;BR /&gt;kill -15 `cat /tmp/bann.test|grep -v $bann_count`&lt;BR /&gt;sleep 5&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Keep the above code in a file and keep it running.&lt;BR /&gt;&lt;BR /&gt;This puts the pid of first bshell in a variable and then keeps on checking if other bshells are coming and if gets it puts pids in file and finally kills all bshells except the first one-saved in bann_count variable.&lt;BR /&gt;&lt;BR /&gt;Regards,</description>
      <pubDate>Mon, 08 Jul 2002 15:11:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/limit-user-login/m-p/2759400#M831329</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2002-07-08T15:11:40Z</dc:date>
    </item>
    <item>
      <title>Re: limit user login</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/limit-user-login/m-p/2759401#M831330</link>
      <description>Hi Manoj ,&lt;BR /&gt;I trying used your scripts and put in to /etc/profile at last line .And I try login again ,giving a syntax error .&lt;BR /&gt;&lt;BR /&gt;You have mail.&lt;BR /&gt;/etc/profile[132]:Syntax error:`&amp;amp;' is not expected .&lt;BR /&gt;&lt;BR /&gt;Please advice me how to slove it&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Leongko</description>
      <pubDate>Thu, 30 Jun 2005 03:25:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/limit-user-login/m-p/2759401#M831330</guid>
      <dc:creator>kevin leong</dc:creator>
      <dc:date>2005-06-30T03:25:36Z</dc:date>
    </item>
    <item>
      <title>Re: limit user login</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/limit-user-login/m-p/2759402#M831331</link>
      <description>You can try do it simply as,&lt;BR /&gt;&lt;BR /&gt;   MAX_LOGIN=5&lt;BR /&gt;   if [[ $(who | grep $LOGNAME | wc -l) -gt $MAX_LOGIN ]]&lt;BR /&gt;   then &lt;BR /&gt; &lt;BR /&gt;       echo "User $LOGNAME: Login Limit $MAX_LOGIN is over. Try after some time"&lt;BR /&gt;       sleep 1&lt;BR /&gt;       exit 1&lt;BR /&gt;   fi&lt;BR /&gt;&lt;BR /&gt;hth.</description>
      <pubDate>Thu, 30 Jun 2005 07:02:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/limit-user-login/m-p/2759402#M831331</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-06-30T07:02:19Z</dc:date>
    </item>
    <item>
      <title>Re: limit user login</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/limit-user-login/m-p/2759403#M831332</link>
      <description>Put the above script in /etc/profile file to control globally.&lt;BR /&gt;&lt;BR /&gt;hth.</description>
      <pubDate>Thu, 30 Jun 2005 07:03:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/limit-user-login/m-p/2759403#M831332</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-06-30T07:03:30Z</dc:date>
    </item>
  </channel>
</rss>

