From owner-freebsd-isp Fri Jul 27 22: 8:19 2001 Delivered-To: freebsd-isp@freebsd.org Received: from mail.plug.cx (kypo.alfred.cx [150.101.93.134]) by hub.freebsd.org (Postfix) with ESMTP id E505937B405 for ; Fri, 27 Jul 2001 22:08:16 -0700 (PDT) (envelope-from andrew.reid@plug.cx) Received: from [210.11.40.230] (unknown [210.11.40.230]) by mail.plug.cx (Postfix) with ESMTP id 9E8F02B7E4; Sun, 29 Jul 2001 00:30:28 +0930 (CST) Subject: Re: autolock on users acc if he/she didnt login for last 30 days From: Andrew Reid To: alexus Cc: freebsd-isp@FreeBSD.ORG In-Reply-To: <000901c10fc1$f98d0d00$0d00a8c0@alexus> References: <000901c10fc1$f98d0d00$0d00a8c0@alexus> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <996240684.4218.16.camel@percible.alfred.cx> Mime-Version: 1.0 X-Mailer: Evolution/0.11 (Beta Release) Date: 28 Jul 2001 14:37:39 +0930 Sender: owner-freebsd-isp@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org 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