Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


How can we stop multiple logins?

Posted on 2006-06-19
Medium Priority
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?
Question by:htgits
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
LVL 12

Accepted Solution

tel2 earned 1000 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?

Author Comment

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

Assisted Solution

JJSmith earned 1000 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.


#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.

LVL 12

Expert Comment

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.

Expert Comment

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

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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.

715 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