Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how can i avvoid users to login with the same login name? 2

Status
Not open for further replies.

demetrio

Technical User
Jul 17, 2002
70
GR
i am running a sco 5.0.7 unix. some users login twice or more using the same login name. some others login using the
login name and passwords of the others although i have create an account of each user. is there anything i can do
to block this so only one account of eache login name can login to the system?
thank you
 
You can use something like this:
[ `who | grep -c "^$LOGNAME "` -gt 1 ] && exit 0

This is that I use in the user's profile (login shell=ksh):
[ $(who | grep -c "^$LOGNAME[ ]") -gt 1 ] && {
who -H | awk 'NR==1 || $1=="'$LOGNAME'" {print}'
id; echo "$LOGNAME already connected"
jobs >/dev/null 2>&1 # no 'You have running jobs' error
exit 2
}

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
sorry for asking again but i dont have much expirience with unix. shall i write both on them

[ `who | grep -c "^$LOGNAME "` -gt 1 ] && exit 0

[ $(who | grep -c "^$LOGNAME[ ]") -gt 1 ] && {
who -H | awk 'NR==1 || $1=="'$LOGNAME'" {print}'
id; echo "$LOGNAME already connected"
jobs >/dev/null 2>&1 # no 'You have running jobs' error
exit 2



to the .profile on the directory that the users logon. all the users logon to a directory /u2/prog whrere thre is the .profile .what other changes do i have to do there?
thank you again
 
Hi demetrio,

No, you should write only ONE of PHV's answers (the second is an "extended" version of the first one). You can put it in /u2/prog/.profile or in /etc/profile (for ALL users).

Theophilos.

-----------

There are only 10 kinds of people: Those who understand binary and those who don't.
 
thank you both. you help me a lot. they both work. for your expiriance which is the right shell (sh or ksh )to logon the users.? there are 100 users logon to that directory , and they just runing a cobol program as soon as the logon.
they do nothing else?
thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top