- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Telnet sessions limit by user.
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2005 01:45 AM
06-01-2005 01:45 AM
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2005 01:56 AM
06-01-2005 01:56 AM
Solutionps -ef | grep telnetd | awk '{print $1} > /tmp/file
while read -r username
do
numsession=$(ps -ef | grep $username | grep telnetd | wc -l)
if [ numsession -gt 1 ]
then
pid=$(ps -ef | grep $username | awk '{print $2}')
kill $pid
fi
done < /tmp/file
Some code modification required for smooth operation. Depending on the application that is being used, you may need to add code to handle smooth session shutdown.
Even better: in /etc/profile
telsession=$(ps -ef | grep $LOGNAME | grep telnetd| wc -l)
if [ telsession -ge 1 ]
then
echo "already logged in, one session per customer"
sleep 15
exit
fi
Take out the sleep to avoid user breaking to the shell.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2005 02:01 AM
06-01-2005 02:01 AM
Re: Telnet sessions limit by user.
The /etc/profile mod is probably the best bet; however, it doesn't take into account other access methods such as ssh or rlogin. You could run a ps -ef | grep ${user} | grep ksh to find out if the user has an active shell. Another good modification would be to have an exclusion list. For instnace, sysadmins and dbas could be allowed to have multiple sessions while normal users are only allowed one.
If you're absolutely sure that the only access method is telnet, then the /etc/profile mod as written will do what you want.
HTH;
Doug
------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2005 03:18 AM
06-01-2005 03:18 AM
Re: Telnet sessions limit by user.
if you want it instantaneous then put it /etc/profile
or from a cron job:
w
minus the count by 2 to take care of the title output of w
then take the decision
Regards,
Gopi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2005 06:32 AM
06-01-2005 06:32 AM
Re: Telnet sessions limit by user.
Dave
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2005 06:45 AM
06-01-2005 06:45 AM
Re: Telnet sessions limit by user.
Anyone test it?
SEP
Contact form that mail's me offline:
http://www.isnamerica.com/isninquire.shtml
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com