Operating System - Tru64 Unix
1751882 Members
5357 Online
108783 Solutions
New Discussion юеВ

Re: C2 check user profile id

 
Rupert_1
Advisor

C2 check user profile id

Hi,

Tru64 V4.0f, C2 security.I want to do housekeepng, what command to use to find out the user which has not login for 100 days.
I have more than 200 users.
Thks.
2 REPLIES 2
Ivan Ferreira
Honored Contributor

Re: C2 check user profile id

This perl script should do the job:

$NOW = time();
$LINE = `/usr/sbin/edauth -g $ARGV[0] | grep u_suclog`;

@FIELDS = split(/:/,$LINE);
foreach (@FIELDS) {
if ( $_ =~ /u_suclog/ )
{ ($junk,$TIME) = split(/#/);} }

$TIMEDIFF=$NOW-$TIME;

if ($TIMEDIFF > 8640000) {
print "The user has not logged on since 100 days or more\n";
print "Last access : ", scalar localtime($TIME), "\n";
}


Save as check.pl and run:

perl check.pl username
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Ivan Ferreira
Honored Contributor

Re: C2 check user profile id

You can also run like this:

for user in `cut -d":" -f1 /etc/passwd`; do checkuser.pl; done
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?