Restriction for more than one user


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Restriction for more than one user
# 1  
Old 03-26-2003
Restriction for more than one user

How do l restrict more than one users on a multiple programming environment using the c shell profile. That is if a user is log-on on one terminal the system should be able to prompt a message if the users attempt to log on on another terminal. I user openserver 5.0.4 with dummy terminals, and also intelligent workstation using telnet.

Thanks

Kayode
# 2  
Old 03-26-2003
Here's one you could try:
Code:
Restrict number of logins allowed for a user

To restrict multiple logins, place the following lines in the users .profile 

# Limit number of logins allowed
Times_allowed=2
Time_in=`who | grep $LOGNAME | wc -l`
if [ $Time_in -gt "$Times_allowed" ]
then
  echo "$LOGNAME is already logged in $Times_allowed times!"
  exit
  exec /bin/login
fi

Then chmod 444 and chown root .profile

# 3  
Old 03-27-2003
Just an FYI on the script above - you will never get the chance to "exec /bin/login" if you exit right before.
It shouldn't matter though - when you logout, another should be spawned.
# 4  
Old 03-27-2003
I didn't write that program, so I don't know for sure, but isn't it just forcing the user to logoff (exit command) and then providing another prompt so that some different user could potentially log on?
# 5  
Old 03-28-2003
Hello! Mr oombera

Thanks for the script. However, l made a mistaken of the type of shell script l have on my system. It is Bourne Shell and not C shell.
I tried running the above script on my system but l am prompt with the following errors:

-rsh : who : not found
-rsh : grep : not found
-rsh : wc : not found
-rsh : test : argument expected

Does it mean that C Shell script can't run on Bourne Shell script?

Thanks

Kayode
# 6  
Old 03-28-2003
oombera, inittab and getty takes care of respawning the login prompt after a user exits, so you dont have to worry about providing another login prompt.
# 7  
Old 03-28-2003
norsk hedensk, I understand what you're saying... maybe the script was written for an older system? maybe the programmer has a habit of including unneeded code? Smilie

kayode, I'm not sure why it's giving you those errors.. try including #!/bin/sh at the top of the script.. other than that, those commands are pretty common on all unices.. unless they weren't installed on your system somehow..

Can you go to a command prompt and type any of them? For example:
who | grep <your_user_name>
wc <some_file>
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Sudo -s restriction

Is there a way to stop users envoking a root shell with sudo on Solaris 10. I want users to use sudo <cmd> but not sudo -s (5 Replies)
Discussion started by: u20sr
5 Replies

2. AIX

User restriction on C/C++ compiler on AIX

Hello, I am curious that is there a way I can restrict a user or a set of users to execute the C/C++ compiler, basically what I want is to lock it down to a particular user and none of the other users should be able to compile any code. Thanks in advance. (14 Replies)
Discussion started by: m6248m
14 Replies

3. Linux

SFTP user access restriction to his home dir

Hi Friends, I have installed a FTP Server on my Linux machine (Fedora 11). I want the ftp users to be restricted to their own home dir using sftp. But the said condition is met when the user logs in using ftp over port 21 and when the user logs in using sftp i.e. protocol 22, he/she has... (4 Replies)
Discussion started by: pashy
4 Replies

4. UNIX for Dummies Questions & Answers

Create a new user with restriction

Hello, I would to create a new user with some restriction: 1. The user will not be able to CD any directory (I mean he'll login to the defined home directory and that's all). 2. The user will not be able to delete anything in that home directory Thanks a lot in advance, Shahar (1 Reply)
Discussion started by: shaharoz
1 Replies

5. AIX

Print queue restriction

Hi, I'm at AIX 5.3, I have a print queue named chqprinter, I want to allow access to print only 2 users to that print queue, jobs printed by all other users to above queue should be deleted. Any idea how to achieve that? ---------- Post updated at 10:33 AM ---------- Previous update was at... (5 Replies)
Discussion started by: tayyabq8
5 Replies

6. UNIX for Advanced & Expert Users

User restriction

Dear All I had one user called msc. In that i had two folder.xxx and yyy ex: /home/msc/xxx ex: /home/msc/yyy Now i want that msc user only able to access xxx folder only. No other folder should be visible to it. Kindly let me know. How it possile?? Regards Jaydeep (3 Replies)
Discussion started by: jaydeep_sadaria
3 Replies

7. AIX

user session restriction

hi, I am facing a problem from the remote system if i login to my AIX5.3 machine as root (thru telnet) the session does not expire for 2 hours even if the session is kept ideal But whenever i do the same thing from some other user then the session is lost within 10 minutes (if session is kept... (2 Replies)
Discussion started by: pchangba
2 Replies

8. AIX

user session restriction

I want to restrict user's loging according to number of session. example the user named "patrik" can be login concurrently from 12 stations thru telnet the 13th if some body tries to telnet 13th session it should not allow, until any of the 12 sessions are closed. is it possibel ...i think... (2 Replies)
Discussion started by: pchangba1
2 Replies

9. Solaris

FTP Restriction

I have a senario and i wonder how to do it ? i used NcFTPd and i dont think its applicable using that application or i didnt know how to configure it. i want to have a user for FTP that user is only restricted to put and get from a certain directory and all sub-directories for that directory,... (0 Replies)
Discussion started by: mduweik
0 Replies

10. Filesystems, Disks and Memory

Restriction to User

Dear all, I am trying to create a new user account that can have the minimum access to the HP-Ux box, as in it only need to perform system info query like bdf and only able to read access system log files but not able to delete any file from any other directory beside it's own user directory... (5 Replies)
Discussion started by: gelbvonn
5 Replies
Login or Register to Ask a Question