- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Limit user access to 3 sessions only
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
01-14-2003 08:21 AM
01-14-2003 08:21 AM
I wish to limit user access to a maximum of 3 login sessions each and also allow a small group of user unlimited login access.
I have changed the Number_of_logins_allowed to 3 in /etc/default/security
What else do I need to do ?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2003 08:37 AM
01-14-2003 08:37 AM
Re: Limit user access to 3 sessions only
there isnt any param that you can use but i found this metod to do the job .
To restrict multiple logins:
You can prevent a user from logging in multiple times by
placing the following lines in the user's .profile:
# Limit number of logins allowed
Times_allowed=3
Time_in=`who | grep $LOGNAME | wc -l`
if [ $Time_in -gt "$Times_allowed" ]
then
echo "$LOGNAME is already logged in $Times_allowed times!"
exit
exec /bin/login
fi
chmod 444 and chown root .profile
If the user attempts to login while that login name is already in
use, the user will get logged out again. A limited number of multiple
logins can be allowed by changing the times_allowed to the acceptable
number of logins.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2003 08:40 AM
01-14-2003 08:40 AM
Re: Limit user access to 3 sessions only
man tsm
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2003 08:45 AM
01-14-2003 08:45 AM
SolutionAlan Titchmarch,Mr,IT_TEAM,2
I then have some scripting in a global profile which looks at this field and limits additional logins beyond this figure.
This way you can specify different levels.
The scripting in my global profile is -
#############################################
# Step to limit Shell Logins if fourth field of /etc/passwd
# description field is set to a numeric limit.
# ie fred flintstone,Mr,ROCK_TEAM,2 sets limit to 2 sessions
# NXW - 29/10/01
#############################################
USER=$(whoami)
echo $USER|egrep -q '(informix|dba)'
if [ ! $? -eq 0 ]
then
trap "exec exit" INT
TMPLOG=/tmp/login_limit.tmp
DATE=$(date)
LIMIT=$(grep ^$USER: /etc/passwd|cut -d":" -f5|cut -d"," -f4)
COUNT=$(ps -fu"$USER"|grep "$USER"|grep "\-ksh"|grep -v grep|wc -l)
if [ $LIMIT -o $LIMIT -ne 0 ]
then
if [ $COUNT -gt $LIMIT ]
then
echo "Sorry you are only allowed $LIMIT session(s) - Press Enter \c"
read NOTHING
echo "$DATE - $USER with $COUNT shells active tried to exceed $LIMIT ses
sions" >> $TMPLOG
ps -fu"$USER"|grep "$USER"|grep -v grep >> $TMPLOG
ps -fu"$USER"|grep "$USER"|grep -v grep >> $TMPLOG
exit
fi
fi
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2003 08:46 AM
01-14-2003 08:46 AM
Re: Limit user access to 3 sessions only
I don't think there is any configuration file that can help you with achieving both of them.
I would suggest you create a file with the following configuration
cat /etc/myuser.conf
user1:3
user2:3
user3:2
user4:x
Now append this small check after the "trap" line your /etc/profile
ME=$(whoami)
LOGINS_ALLOWED=$(grep ^$ME /etc/myuser.conf |awk '{FS=":";print $2}')
CURRENT_LOGINS=$(w|grep $ME|wc -l)
if [ "${CURRENT_LOGINS}" -gt "${LOGINS_ALLOWED}" ]
then
clear
echo "You exceeded number of logins"
exit
fi
Write a corresponding c-shell script and put it in /etc/csh.login
You can alter your /etc/myuser.conf for any user for any number of logins.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2003 08:53 AM
01-14-2003 08:53 AM
Re: Limit user access to 3 sessions only
Sorry, I may have lead you astray.. I should have said -> I wish to limit users access - not just one user....
What I want is the default login sessions to be 3 for almost all users and a small number of users with unlimited access.
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2003 08:54 AM
01-14-2003 08:54 AM
Re: Limit user access to 3 sessions only
ME=$(whoami)
grep "^$ME" /etc/myuser.conf > /dev/null 2>&1
if [ $? = 0 ]
then
LOGINS_ALLOWED=$(grep ^$ME /etc/myuser.conf |awk '{FS=":";print $2}')
CURRENT_LOGINS=$(w|grep $ME|wc -l)
if [ "${CURRENT_LOGINS}" -gt "${LOGINS_ALLOWED}" ]
then
clear
echo "You exceeded number of logins"
exit
fi
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2003 08:55 AM
01-14-2003 08:55 AM
Re: Limit user access to 3 sessions only
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2003 08:58 AM
01-14-2003 08:58 AM
Re: Limit user access to 3 sessions only
Definition in /etc/default/security file must be in caps, i.e:
NUMBER_OF_LOGINS_ALLOWED=3
This apply forn no-root users (su excluded)
Rgds.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2003 09:02 AM
01-14-2003 09:02 AM
Re: Limit user access to 3 sessions only
Have you installed PHCO_26089 patch (or replacement if superceeded) in your box?
Rgds.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2003 03:33 AM
01-15-2003 03:33 AM
Re: Limit user access to 3 sessions only
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2003 04:06 AM
01-15-2003 04:06 AM
Re: Limit user access to 3 sessions only
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2003 04:35 AM
01-15-2003 04:35 AM
Re: Limit user access to 3 sessions only
:-) Dietmar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2003 04:57 AM
01-15-2003 04:57 AM
Re: Limit user access to 3 sessions only
Thanks for all the replies..
I have decided to go with Nick's advice and change the password file to include a user limit against each user and add the script to
our common login profile.
On a side issue - does anyone think this will
slow down a user login process and lead to greater password file administration ?
Original issue closed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2003 06:24 AM
01-15-2003 06:24 AM
Re: Limit user access to 3 sessions only
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2003 06:49 AM
01-15-2003 06:49 AM
Re: Limit user access to 3 sessions only
I would not suggest using /etc/passwd as the GECOS field is modifiable by the user.
Use your own configuration file as I indicated. You can configure it only for the users that you want to put restrictions on.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2003 08:31 AM
01-15-2003 08:31 AM
Re: Limit user access to 3 sessions only
I think that this is due to the deficiency of a patch, on 11.0 you must install PHCO_27721
Look a symtom solved by this patch:
When the maximum number of logins to the system allowed for each user is specified by the NUMBER_OF_LOGINS_ALLOWED field in the /etc/default/security file, users whose names are longer than 4 bytes are treated as the same user if the first 4 bytes of the user names are identical.
Rgds.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2004 02:46 PM
02-09-2004 02:46 PM