Solved

Restricting a Unix user

Posted on 2008-10-31
6
372 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
  • 2
  • 2
  • 2
6 Comments
 
LVL 48

Accepted Solution

by:
Tintin earned 400 total points
Comment Utility
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
Comment Utility
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
Comment Utility
You said you wanted this for the 'oracle' user.  How many users do you want it for?
0
Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

 
LVL 13

Author Comment

by:sonicefu
Comment Utility
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
Comment Utility
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 100 total points
Comment Utility
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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

The term "Bad USB" is a buzz word that is usually used when talking about attacks on computer systems that involve USB devices. In this article, I will show what possibilities modern windows systems (win8.x and win10) offer to fight these attacks wi…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
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…

743 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now