1835215 Members
2343 Online
110078 Solutions
New Discussion

control user login

 
hanyyu1
Advisor

control user login

In my server , we only allow 70 telnet session to my system , to control the system resource , if I want to assign 10 telnet session out of these 70 only for a specific login id ( eg. edp_usr ), that mean all users ( except edp_usr ) can only use max. 60 telnet session , another 10 telnet session only reserve for edp_usr , is it possible ? thx.
3 REPLIES 3
saju_2
Respected Contributor

Re: control user login

Hi

I would like to put a checking on the . profile of that particular user to verify how many users with that particlar username exists, if it is moe than 10 echo a messeage on the screen saying that "Cannot login since login numbers exceeded" and quit.

Something like who -u|awk '{print $1}' and check

Will that do?

Regards
CS
hanyyu1
Advisor

Re: control user login

thx r suggestion ,

I understand your mean but actually I also want to control the normal user can only use 60 telnet session , ( even the edp_usr is not logging on , the common user can use only max. of 60 telnet , because only 60 application license is available ) , is it possible ? thx.
Muthukumar_5
Honored Contributor

Re: control user login

Yes surely you can with /etc/profile file scripting.

--- /etc/profile ---
ps | grep -q 'telnet'
if [[ $? -eq 0 ]]
then
if [[ $(who | wc -l) -ge 60 && ${LOGNAME} != "edp_usr" ]]
then
echo "Telnet session limit is reached. Try after some time"
sleep 1
exit 1
elif [[ $(who | wc -l) -gt 70 && ${LOGNAME} = "edp_usr" ]]
then
echo "Telnet licensed sessions limit is reached - 70. Try later"
sleep 2
exit 1
fi
fi

Save this.

hth.



Easy to suggest when don't know about the problem!