- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- How to allow user login only one time.
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-28-2005 08:53 PM
06-28-2005 08:53 PM
I have many user login to server but how to dis-allow user login many time?
Any security require to setup ?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2005 09:02 PM
06-28-2005 09:02 PM
Solutionthis is possible! below a quote from "man login"
Refer to the /etc/default/security file in the security(4) man page for detailed information on configurable parameters that affect the behavior of this command. Currently supported parameters are:
ABORT_LOGIN_ON_MISSING_HOMEDIR
NOLOGIN
NUMBER_OF_LOGINS_ALLOWED
hope this helps!
regards
yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2005 09:16 PM
06-28-2005 09:16 PM
Re: How to allow user login only one time.
Else, with /etc/profile file as,
if [[ $(users | grep $LOGNAME|wc -w) -gt 2 ]]
then
echo "User name $LOGNAME is having more sessions. Try later"
sleep 2
exit 1
fi
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2005 10:45 PM
06-28-2005 10:45 PM
Re: How to allow user login only one time.
i sometimes use Muthukumar's way and
believe me it always works...
Good Luck,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2005 06:41 AM
07-11-2005 06:41 AM
Re: How to allow user login only one time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2005 03:03 PM
07-11-2005 03:03 PM
Re: How to allow user login only one time.
In this script you initiate a small command after 1 min of login which writes a "exit" at the end of .profile
So once they have logged in, they won't be able to log in again.
Something like:
echo exit >> $HOME/.profile
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2005 08:35 PM
07-11-2005 08:35 PM
Re: How to allow user login only one time.
You can put this line at the end of .profile in
[[ `who | grep
for the
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2005 09:22 AM
07-12-2005 09:22 AM
Re: How to allow user login only one time.
is unlikely to be reliable. Suppose I'm grepping for root and there are users named shroot, root37, etc. logged in. How would this affect the results of the grep and wc commands?
This is perhaps a relatively harmless example of some potentially deadly problems with unanchored greps.
I remember years ago a junior operator tried to impress his boss by writing a shell script that tried to be equivalent to the HP-UX 'userdel' command. It took the argument (a user name) as the name of the account to delete, looked for the home directory of that user, and clobbered the home directory before removing the relevant line from /etc/passwd. At least that was the way the script was supposed to work.
The operator carefully tested the script under all of the conditions he could think of. He worked very hard on it whenever he had a few minutes before changing backup tapes.
Weeks passed. He was almost ready to show the boss to try to impress him, but decided to do one more test to make sure his code was perfect... The final test:
# rmuser hi
OK, what's in /etc/passwd that matches 'hi' ?
root:
hi:
Oh, 'hi' matches the first part of 'himself' so I'll just cd to / and rm -rf it. Oops! That's not what I meant!!!
Needless to say, the operator did not get the promotion he was hoping for, and learned a very valuable lesson about anchored searches in grep!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2005 04:57 PM
07-12-2005 04:57 PM
Re: How to allow user login only one time.
I would fully agree with Doug Hosking's
suggestion. While using grep, be very
careful.
Note also that the $HOME/.profile is owned by
the user, so nothing stops him/her from
deleting the lines you just added. Putting
the script in /etc/profile is also open to
abuse as the user can use "Ctrl+|" to stop
execution of /etc/profile (as one of the
above post suggests "sleep 2" in the script
before exit, it would be even easier to
terminate /etc/profile and negate what you
are trying to achieve.
The correct way is to use /etc/default/security file as suggested by
many above.
- Biswajit