I noticed in another thread "thread690-1251570" 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 **********
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.
Thanks,
Johnny
******** START OF SCRIPT **********
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.
Thanks,
Johnny