Operating System - Linux
1753798 Members
7892 Online
108805 Solutions
New Discussion юеВ

Users that never logged in

 
uadm26
Super Advisor

Users that never logged in

Hi,

There's a way to get a user list that never logged in a system (11i), to put in a script used to manage users? Outputs of the commands last and to finger seems not to be the better way.

Thank's for all.
3 REPLIES 3
Steven E. Protter
Exalted Contributor

Re: Users that never logged in

Shalom,

passwd -sa

may work. It does on trusted systems produce a report that includes users that have never been used.

You should if office rules permit make sure those accoutns expire, although that seems to be what you may be moving toward.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
spex
Honored Contributor

Re: Users that never logged in

Hi Joel,

This script expects that '/etc/password' contains an entry for each user, and 'last' reports the complete login history. It outputs to stdout.

#!/usr/bin/sh

last | cut -d' ' -f1 > /tmp/who.${$}.out.1
cut -d: -f1 /etc/passwd >> tmp/who.${$}.out.1
sort < /tmp/who.${$}.out.1 > /tmp/who.${$}.out.2
uniq -u < /tmp/who.${$}.out.2
rm -f /tmp/who.${$}.out.[1,2]

exit 0

PCS
uadm26
Super Advisor

Re: Users that never logged in

Hi,

Is'nt so simple, there's others variables, like connection by aplications and so long. But thanks for all.