Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CMS User login session limit

CMS

CMS User login session limit

by  aphophas  Posted    (Edited  )
I noticed in another thread "thread690-1251570: CMS logins/CentreVu 13.0: CMS logins/CentreVu 13.0" there was some info shared about this topic. I have been using something on my CMS for sometime, and works beautifully. Just replace the "/usr/bin/cms" with the new "/usr/bin/something" replacement


******** START OF SCRIPT **********
Code:
LOGINTAB="/etc/logins.table"

LOGINMAX=`grep '^[      ]*'$LOGNAME $LOGINTAB | tr -s "\011" " " | \

          cut -f2 -d' '`

[ -z "${LOGINMAX}" ] && LOGINMAX=8

TTY=`ps -p $$ | grep -v PID | tr -s "\011" " " | cut -f3 -d' '`

echo "You are logging in at line $TTY ..."

LOGINDEV=`/usr/bin/w | grep \^$LOGNAME | grep -v $TTY | \

          tr -s "\011" " " | \

          cut -f2 -d' ' | tr -s "\012" " "`

if [ $LOGINMAX -ne 0 ]

   then

         LOGINCNT=`echo $LOGINDEV | wc -w 2> /dev/null`

         LOGINCNT=`expr ${LOGINCNT:-0} + 0`

echo "Total number of sessions loggedin $LOGINCNT"

         if [ $LOGINCNT -gt $LOGINMAX ]
            then
echo $LOGINCNT
#                  /usr/ucb/logger -p daemon.notice -t PROFILE \

#      "Denied login - user <$LOGNAME> - lines $TTY and $LOGINDEV"

                  echo "You are already logged in [$LOGINDEV] ..."

                  sleep 3

                  kill -KILL $$

            fi

   fi



/usr/bin/cms
********** END OF SCRIPT **********

The line "[ -z "${LOGINMAX}" ] && LOGINMAX=8" controls the amount of logins per user. This particular one is set for 8 sessions for the user that has this applied to their account. Just tweak the number to the amount you want, then save the file.

Just create the new file in "/usr/bin/something", then chmod to 755. Apply the new file either by editing the "/etc/passwd" file or through the GUI using "admintool". Of course depending on your preference, and version of Solaris.
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top