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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Limit Pc-session Telnet to Server Sco Unix 6.0

Status
Not open for further replies.

dellit

IS-IT--Management
Jan 21, 2007
65
IT
Hi,
I would want to limit sessions telnet for every PC on Server Sco Unix 6,0; to two session for Client. How I can make?
Thanks
 
You can do this with the user's login script. You can obtain the IP address and look for other existing sessions on the same IP. If there are already 2 sessions active, you just give them a little notification and bail out.

You can get the current IP with a command like this:

MYID=`who -mx | tr -s " " | cut -f6 -d" "`

Use that variable and the "who -x" command to get a listing of other sessions from the same IP. If the list includes >2 lines, get out.

"Proof that there is intelligent life in Oregon. Well, Life anyway.
 
Hi motoslide,

thanks for the answer.
I do not succeed to use the variable and tho who -x.
you can help me?
I use the .profile on Sco 6.0
Thanks



 
I'm sure others can make this more compact, but this is how I would typically accomplish your task:

Code:
MYID=`who -mx|tr -s " "|cut -f6 -d" "`
HOWMANY=`finger|grep ${MYID}|wc -l`
if [ $HOWMANY -gt 2 ]
        then
        echo "Too many logins"
        exec sleep 3
        exit
        else
        echo "Welcome..."
fi


This would be in the users' .profile script.


"Proof that there is intelligent life in Oregon. Well, Life anyway.
 
Hi motoslide,

Ok,
it works all.
Thanks for the support.
dellit
 
I'd recommend adding it to /etc/profile instead (users with know-how would be able to remove it from their own .profiles unless they were owned by root). You could add some code around it to make sure that section of code was skipped for root logins.

Annihilannic.
 
I agree 100% Annihilannic. I was being cautious by recommending a standard user's profile until the script was tested. It can be a pain when you get a syntax error in /etc/profile.



"Proof that there is intelligent life in Oregon. Well, Life anyway.
 
Absolutely... always make sure you have another session open when you're hacking /etc/profile until you've tested your changes, just in case you find you can't log in again!

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top