?
Solved

Restricting a Unix user

Posted on 2008-10-31
6
Medium Priority
?
383 Views
Last Modified: 2013-12-27
Hello Experts,

How can I restrict an OS user to login for more than once. For example I want to restrict Operating System user named 'oracle' to open multiple shell terminals, he could only be able to login once from telnet only. If I'm logged in to Oracle Database Server using telnet from workstation (client) A at the same time an other person is also trying to log in to Oracle database server from workstation B with the same OS user 'oracle' then the person B should receive a message that "You cannot be logged in with this user...".

I want to implement this restriction using bash shell script, at Sun Solaris.

Kind Regards,

sonicefu
0
Comment
Question by:sonicefu
[X]
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
  • 2
  • 2
  • 2
6 Comments
 
LVL 48

Accepted Solution

by:
Tintin earned 1600 total points
ID: 22855856
In the Oracle .bash_profile, put

if [ `w | grep -c [o]racle` -gt 1 ]
then
     echo "You cannot be logged in with this user...."
     exit
fi


0
 
LVL 13

Author Comment

by:sonicefu
ID: 22855923
Thanks a lot !

How can I implement if for multiple users ? is there any dynamic way

oracle
root
ora_dba
0
 
LVL 48

Expert Comment

by:Tintin
ID: 22855927
You said you wanted this for the 'oracle' user.  How many users do you want it for?
0
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
LVL 13

Author Comment

by:sonicefu
ID: 22855932
Sorry, I can send it in an other question, should I ?

I need it dynamic, if I make it a file having list of users to restrict will it work and how ?
0
 
LVL 11

Expert Comment

by:jgiordano
ID: 22856956
I wouldn't do it for root. If someone is logged in and you need to get on for some type of maintenance you might have a problem.

0
 
LVL 11

Assisted Solution

by:jgiordano
jgiordano earned 400 total points
ID: 22856986
If it is the latest rev of solaris 10 (update 5) you may be able to use resource control

http://blogs.sun.com/darren/entry/limiting_users_to_one_login
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Article by: btan
The intent is not to repeat what many has know about Ransomware but more to join its dots of what is it, who are the victims, why it exists, when and how we respond on infection. Lastly, sum up in a glance to share such information with more to help…
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…
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.
Suggested Courses
Course of the Month8 days, 14 hours left to enroll

764 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