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

UNIX Scripting Forum 1

Status
Not open for further replies.

mbangura

MIS
Jul 10, 2001
1
US
Can anyone help me write a shellscript that will will be placed in the profile of a user so that that user will be able to login to the system only once; after that if the user tries again he should be locked out and an email sent to the administrator. Please help me
 
Hi:

the following command allows a user to login only once:

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

You should be able to modify it to fit your needs. Since the "w" prints a summary of who is logged into a system, if more than one instance of the user exists, terminate the user's login process.

If it were me, I'd place this in /etc/profile. If you place it in the user's .profile, they can edit it, if said user has command-line access.

Regards,

Ed


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top