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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Limit login to one 4

Status
Not open for further replies.

BIS

Technical User
Jun 1, 2001
1,893
0
36
NL
Is it possible to force a SunOS system to not accept the login if a user is already login on the same machine but with another computer ?
 
Hi:

This should only allow a user to log in only once:

[ `w -h -s| cut -d" " -f1 | grep "^$LOGNAME$" | wc -l` -gt 1 ] && exit 0

Beware that this doesn't take into account the user pressing the interrupt key and circumventing the above command.

Regards,

Ed
 
Many thanks. Where would I put this code?
 
Sorry, I should have been more clear.

I'd place it in /etc/profile. You'll need root privileges to make the change.

Since you're running solaris, the LOGNAME variable should be set. If it isn't let me know, and I can provide you code to do that.

Regards,

Ed
 
You might want to exclude [tt]root[/tt] from this test. It could come back to bite you! Maybe add a "[tt]| grep -v root |[/tt]" in the pipe.

Hope this helps.

 
I thought that /etc/profile is only called if the user is using ksh.... So you may want to make sure all your users are using it....
We have many application user IDs that use csh....
Look at /etc/csh.login
 
The login script [tt]/etc/profile[/tt] is for Bourne shell or Korn shell. The C Shell uses [tt]/etc/.login[/tt].

Hope this helps.
 
Many thanks folks, this is very helpful. Small problem though, this Solaris box is basically a call-detail-records recording thingy (part of an Avaya (Lucent) PBX) and it looks as if it uses some propriatary software. In our field we call it CMS (short for call management system), and all users have /usr/bin/cms as their shell. Root is using /usr/bin/ksh. I think I better not start fiddling with this, except perhaps if I knew how a shell works. My guess is that that is a bit too complicated for this task though. Many thanks again, I appreciate your input.
 
I know I am a month behind, but I stumbled across this looking for a solution to something else.

I have a CMS machine from Avaya on which I implemented exactly what you want to do and it works fine, limiting uses to only one login on the CMS Supervisor app. You don't have to worry about "root" being locked out, because root doesn't use /usr/bin/cms.

Its not too complicated, and in fact its exactly the code that was mentioned by "olded".

/usr/bin/cms is just a simple shell script. You can edit it with VI like you would any text file and insert the lines below (cut and paste from my /usr/bin/cms). Once you have opened the file, just insert it after the comments.

#
# SHELL: cms
#
# Revisions and descriptions listing...
# more info

if [ `w -h -s| cut -d" " -f1 | grep "^$LOGNAME$" | wc -l` -gt 1 ]
then
exit 0
fi

# Rest of file below
I don't want to cut and paste anything from the file for fear of copyright infringent since this is a proprietary system.

Make a backup of course, and make sure permissions and ownership match. You should be good to go. The only annoying part is if a user tries to use the login twice, CMS Supervisor doesn't tell you that, it just blurts out an error about not being able to login (maybe something about checking a password, or server is currently being backed up.)
 
Excellent - many thanks...
 
Nice stuff

Hai BIS

Please let me know if the information that was provided is helpfull.
Edwin Plat
A.K.A. Europe
 
Hai de Europe,

What you doing over here in the Unix halls....

;-)
 
Hi Guys,

we are becoming crazy.
Following the above instructions we can avoid simultaneous login through Terranova or any emulator, but with CenterVu Supervisor still can log sereval sessions with the same login.

Has anyone done it in CenterVu Supervisor and working?

Saludos

 
Hi Alberton,

In my post on Feb 13, 2004 I did mention that I had gotten it to work on our Avaya CMS Supervisor, so I know it *can* work. Perhaps it depends on shell, O/S and CMS version.

Ours is running on a Sparc Ultra 5 with Solaris 8. CMS version is 11.0.something.

Check that your user(s) in question have a shell set something like below in /etc/passwd:
admin:x:200:200::/export/home/admin:/usr/bin/cms

Maybe you can cut and paste the modifications you made in /usr/bin/cms and I'll do my best to help out.

Hope that helps.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top