1847253 Members
4292 Online
110263 Solutions
New Discussion

Restirct telnet session

 
SOLVED
Go to solution
j773303
Super Advisor

Restirct telnet session

Is it possible restriction telnet session in HP-UX? For example, the user A only can telnet to server 3 sessions, the 4 sesssion will be inhibited.
Hero
8 REPLIES 8
twang
Honored Contributor

Re: Restirct telnet session

You can use /var/adm/inetd.sec to achieve this.
Take a look at "man inetd".
j773303
Super Advisor

Re: Restirct telnet session

/var/adm/inetd.sec is configure client allow or deny telnet access. My mean is control the user only can telnet 3 sessions. Is it possible to do that?
Hero
twang
Honored Contributor
Solution

Re: Restirct telnet session

Sorry for misunderstanding your question, to restrict number of telnet sessions, you may apppend the following script in profile file:
script begin---------
#trap exit 1 2 3 15
Me=`who am i | cut -f1 -d' '`
Cnt=`who -uH | cut -f1 -d' ' | grep "${Me}" | wc -l`
echo "Current active sessions for ${Me} = ${Cnt}.";
sleep 1
if [ "${Cnt}" -gt 3 ]
then
echo "nnWarning: Too many concurrent login
sessions active!07"
echo " Session terminated!07nn"
sleep 5
exit
fi
unset Me Cnt
script end-----------
j773303
Super Advisor

Re: Restirct telnet session

Thanks! A good solution. In my server, there're
many user always connected in, nearly 1000users. If client try to telnet to server and always check the scirpt of profile. I think it will affect the performance. Is there any other solution to restrict the user telnet session?
Hero
twang
Honored Contributor

Re: Restirct telnet session

I think the only way to do such is to check the number of telnets at login time via a script.
Michael Tully
Honored Contributor

Re: Restirct telnet session

Each and every user runs through the same process when they login. There would be no performance loss at all. A standard session:

login
password

reads login shell from the password file
reads /etc/profile
reads the appropriate profile file for the users shell.
If there is an additional script that it run like Twang's, then I don not see any problem. The best way to restrict users is from the calling of a script from /etc/profile or from the users own profile. The problem with calling it from the users own profile is a permission issue.
Anyone for a Mutiny ?
j773303
Super Advisor

Re: Restirct telnet session

who -TH will list the 1000 users login information, doesn't it affect system performance duting execute who -TH? why?
Hero
Ivajlo Yanakiev
Respected Contributor

Re: Restirct telnet session

you have 1000 shell user ?
O my good ! Realy ?
Think about securety. Every chld with internet is ready to hack your server.