- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Limit # of telnet sessions script not working
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
02-05-2003 07:47 PM
02-05-2003 07:47 PM
All users' login shell /usr/bin/sh
.profile :
/scripts/menu/1_sess_only
/scripts/menu/1_sess_only :
/scripts/menu/chk_login_1
(follow by scripts to startup the application if the chk_login_1 script can pass successfully)
/scripts/menu/chk_login_1 :
user=`whoami`
logintime=`finger | grep "^$user " | wc -l`
if [ "$logintime" -gt 1 ]
then
echo ""
echo ""
echo "You are not allowed to login more than 1 session!"
echo ""
exit 1
fi
Of course some have similar scripts with
/scripts/menu/chk_login_2 or
/scripts/menu/chk_login_3
The echo statements work all okay, that I understand it is the "exit 1" statement that cannot logout the telnet session successfully (used to work ok since the server is up running 2 years ago until recently)
What's wrong?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2003 08:16 PM
02-05-2003 08:16 PM
Re: Limit # of telnet sessions script not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2003 08:24 PM
02-05-2003 08:24 PM
Re: Limit # of telnet sessions script not working
I'd use the output from ps instead of finger. Here is a vague hack at it.
`ps -ef | grep telned | grep $user1 | wc -l`
You'll have to work the line out a bit, but it might prove a better thing.
You should disable finger on your system anyway. It gives hackers or malicious users too much information about how your system runs.
In case I haven't diagnosed the problem, please run five telnet sessions yourself, run the script against yourself(not root) and post the output. I'm not going to turn that one loose on my systems because we limit all users to one telnet session because the database they log into reject multiple logins.
P
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
02-05-2003 08:58 PM
02-05-2003 08:58 PM
Re: Limit # of telnet sessions script not working
Is that how it used to be setup? If it had been working for 2 years, what changed?
-denver
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2003 09:38 PM
02-05-2003 09:38 PM
Solution-use-
. /scripts/menu/1_sess_only
-not-
/script/menu/1_sess_only
You might also consider putting "sleep 5" after your last echo... to give enough time to atleast see the message.
hope this helps
-denver
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2003 11:17 PM
02-05-2003 11:17 PM
Re: Limit # of telnet sessions script not working
NUMBER_OF_LOGINS_ALLOWED option in the /etc/default/security file. If you set this to "1" the user will see this message if they try to login more than once:
Exceeds number of logins allowed (1) for user username.
Su access does not go against this count. The root user is also excluded.
If you do not have a /etc/default/security file you can just create one and add this line:
NUMBER_OF_LOGINS_ALLOWED=1
A table listing the available options can be found here: http://newfdawg.com/SHP-RestShell
- Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2003 01:33 AM
02-06-2003 01:33 AM
Re: Limit # of telnet sessions script not working
. /scripts/menu/1_sess_only
just works great! Thanks!
Also found it is the recent change to the script .profile that makes it doesn't work since
Before .profile is :
/scripts/menu/1_sess_only
RC=$?
if [ $RC -ne 0 ]
then
exit
fi
& I have overlooked this.
Thanks for everyone's help/recommendation etc.
Regards,
Rita