Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Jan 1996 11:27:05 -0600 (CST)
From:      Joe Greco <jgreco@brasil.moneng.mei.com>
To:        gestur@islandia.is (Gestur A. Grjetarsson)
Cc:        freebsd-hackers@freebsd.org, freebsd-questions@freebsd.org, admin@islandia.is
Subject:   Re: prevent paralell modem connection
Message-ID:  <199601031727.LAA13230@brasil.moneng.mei.com>
In-Reply-To: <199601031528.PAA12069@hummer.islandia.is> from "Gestur A. Grjetarsson" at Jan 3, 96 03:28:03 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> Hello,
> 
> I'd like to ask you,
> 
> Could users on FreeBSD system hold two or more modem connections at
> same time, parallel logged on ?

Sure.

> If so, is there a way to prevent people to be able to get connection on
> the system from two or more places at one time, like if users share their
> accounts, taking two modems and only paying for one account ?

Sure.  Stick a "cron" job in to count the number of times that a user is on
a tty line.  Think about something like:

#! /bin/sh -

PATH=/bin:/usr/bin; export PATH

who | grep " ttyd" | sort | uniq -c | (
	while read count user; do
		if [ ${count} -gt 1 ]; then
			kill -HUP `ps agxu | grep "^${user} " | awk '{print $2}'`
		fi
	done
)

This is of course very simplistic but could be effective if run out of cron,
say, every 5 minutes (excuse any errors, I have NOT tested it, you shouldn't
run it unless you understand what it is doing and can fix my bugs)...

This is simpler than the network/X11 pty case, of course..  ;-)

> My system has limited amount of modems attached, so it would be of good
> appreaciation if I could manage to prevent parallel modem connections for
> one user.

... Joe

-------------------------------------------------------------------------------
Joe Greco - Systems Administrator			      jgreco@ns.sol.net
Solaria Public Access UNIX - Milwaukee, WI			   414/342-4847



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199601031727.LAA13230>