Skip site navigation (1)Skip section navigation (2)
Date:      28 Jul 2001 14:37:39 +0930
From:      Andrew Reid <andrew.reid@plug.cx>
To:        alexus <ml@db.nexgen.com>
Cc:        freebsd-isp@FreeBSD.ORG
Subject:   Re: autolock on users acc if he/she didnt login for last 30 days
Message-ID:  <996240684.4218.16.camel@percible.alfred.cx>
In-Reply-To: <000901c10fc1$f98d0d00$0d00a8c0@alexus>
References:  <000901c10fc1$f98d0d00$0d00a8c0@alexus>

next in thread | previous in thread | raw e-mail | index | archive | help
On 18 Jul 2001 15:43:52 -0400, alexus wrote:

> is there a way to do if user didn't login on shell for past lets say
> 30 days his account automaticly gonig lock? or change shell to
> /noshell ?

Seeing as I'm not in front of a FreeBSD box at the moment, this is
somewhat off the top of my head...

'lastlog' should have something worthwhile. A simple script called
nightly from CRON would be sufficient.

For example, when I run 'lastlog -u andrew' on my laptop, it tells me
the time and date I last logged into the system (funnily enough).

[andrew@percible log]$ lastlog -u andrew
Username         Port     From             Latest
andrew           :0                        Fri Jul 27 13:12:20 +0930 2001

Now, all you have to do is:

    i   ) Make sure the time, date and timezone is correctly set
    ii  ) Write a bit of [Pp][ython|erl] split and analyze the output
          from 'lastlog -u %s' (where %s is the username)

The script may also wish to check if %s is in whichever group all users
are a member of. This prevents toying with system accounts that display
'**Never logged in**' (you still want to be able to disable normal users
that have not logged in, you see).

   - andrew

--
void signature () {
	cout << "Andrew Reid -- andrew.reid@plug.cx" << endl ;
	cout << "Cell: +61 401 946 813" << endl;
	cout << "Quidquid latine dictum sit, altum viditur" << endl;
}


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-isp" in the body of the message




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