Operating System - HP-UX
1752590 Members
3836 Online
108788 Solutions
New Discussion юеВ

Re: Multiple Telnet Sessions

 
Darrell Albee
Advisor

Multiple Telnet Sessions

Solution given on December 5 by Sridhar Bhaskarla was great however we have since had some people that do need multiple sessions. I have attached the script which was modified and inserted into our profile script to allow certain people multiple sessions. What is happening now is with the modifications the system is only letting someone with the ip address beginning with what is specified in the profile script multiple logins. Example: My ip address ends in 14.2 and if there are 3 people on that end in 14.22 and 14.24 and 14.17 then it does not let me on. How do I correct this problem?
4 REPLIES 4
Jeff Machols
Esteemed Contributor

Re: Multiple Telnet Sessions

try this

NO=`who -R |grep -x $IP|wc -l`
Craig Rants
Honored Contributor

Re: Multiple Telnet Sessions

The -x addition should work for you, you may also want to consider changing all the if/fi statements to one if/elif/elif../fi statement. That would probably work quicker for you down the line if your script keeps growing.

GL,
C
"In theory, there is no difference between theory and practice. But, in practice, there is. " Jan L.A. van de Snepscheut
harry d brown jr
Honored Contributor

Re: Multiple Telnet Sessions


easy:

change your script to use grep:

#######
test=`echo $IP | grep -f ips.allow`
if [ "$test" != "" ]; then
BYPASS='Y'
fi
if [ "$IP" = "" ]; then
BYPASS='Y'
fi

#########
create a file called "ips.allow"::

172.31.17.1$
172.31.16.10$
DTS_TFLEX_TS01$
172.31.17.109$
172.31.17.5$

The "$" tells grep that it is the end of the line, so trailing characters will not match.


live free or die
harry
Live Free or Die
harry d brown jr
Honored Contributor

Re: Multiple Telnet Sessions

Darrell,

using my example as a stand alone script:

ips.allow:
172.31.17.1$
172.31.16.10$
DTS_TFLEX_TS01$
172.31.17.109$
172.31.17.5$

test:
#!/usr/bin/ksh
#
BYPASS='N'
read IP
test=`echo $IP | grep -f ips.allow`
if [ "$test" != "" ]; then
BYPASS='Y'
fi
if [ "$IP" = "" ]; then
BYPASS='Y'
fi
echo $BYPASS


here is a test:

# ./test
172.31.17.11
N
# ./test
172.31.17.1
Y
#

To test for "null" use "ctrl-d" to simulate it, as carriage return is a \n.

live free or die
harry
Live Free or Die