Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

How can we stop multiple logins?

Posted on 2006-06-19
7
533 Views
Last Modified: 2008-01-09
Is there a way to stop multiple remote logins to a AIX Unix server?

If this is possible can we allow multiple logins from a single terminal?
0
Comment
Question by:htgits
7 Comments
 
LVL 12

Accepted Solution

by:
tel2 earned 250 total points
ID: 16938582
Hi htgits,

I don't know of a "build-in" method, but you could have a script which creates a lock file when a user logs on to an account.  When the next user attempts to logon to the same account, it checks that lock file to see if the first user is still on.  If so, then logoff, otherwise, replace the lock file.

Yes, you could allow multiple logons from a single terminal by including something unique about that terminal (eg: IP address) in the lock file, and checking for that.

Does that sound like what you require?
0
 
LVL 3

Author Comment

by:htgits
ID: 16938666
Yes that sounds what we are looking for.

How do we know when a user logs off? I.E. Where would the script go to be executed when the users session ends?

I'm guessing we can also excule the "root" user from this process?

Thanks for you help
0
 
LVL 6

Assisted Solution

by:JJSmith
JJSmith earned 250 total points
ID: 16938797

In a lot of UNIX flavours a user enters through a profile - within this profile you can set a 'trap' to catch the exit signal, amongst others. When catching signals you can do anything you please including removing a flag file.


e.g.
#profile

#set the trap for signals 0 thru 3 - see man signal
trap  "rm -f /tmp/user_login_flag"  0  1  2  3

On your terminal question - do you mean a user can only login once, unless they login again from the same terminal?

To eliminate root from any processing just add ' uid not equal 0 ' to any condition logic you write.

Cheers
JJ
0
 
LVL 12

Expert Comment

by:tel2
ID: 16938884
Hi htgits,

> How do we know when a user logs off? I.E. Where would the script go to be executed when the users session ends?

I assume JJ's option would generally work (I've never tried it), but it may not cater for things like power failures.  You wouldn't need to check when they log off.  What I'm saying is:
> When the next user attempts to logon to the same account, it checks that lock file to see if the first user is still on.
The lock file might be named with the IP address (eg: lock_1.2.3.4) and contain something like the PID for that session.  When the next session is logged on for that account, that PID is checked to see if it still exists (and still belongs to that account).  If it does, then disallow the login.
0
 

Expert Comment

by:nilehawk
ID: 17435117
don't apply any lock method to life system you need to test it first on test plant
good luck
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question