How can we stop multiple logins?

Posted on 2006-06-19
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 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?

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


#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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Ubuntu install gnome-session-fallback is failing 4 119
Linux: disable vim auto-comment 7 157
SCP a file to multiple machines using a script 4 82
Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
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…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

733 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