Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 May 2001 10:56:12 +0100
From:      Jamie Heckford <heckfordj@psi-domain.co.uk>
To:        Sean Winn <sean@gothic.net.au>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: bin/27205: Listing all users in the passwd file
Message-ID:  <20010509105612.A4112@storm.psi-domain.co.uk>
In-Reply-To: <5.1.0.14.2.20010509171743.03e700c0@mail.gothic.net.au>; from sean@gothic.net.au on Wed, May 09, 2001 at 08:30:53 %2B0100
References:  <20010508153202.9C4B5402EC6@rafiu.psi-domain.co.uk> <5.1.0.14.2.20010509171743.03e700c0@mail.gothic.net.au>

next in thread | previous in thread | raw e-mail | index | archive | help
Good points, glad to see the usual FreeBSD approach of allowing
only the best into the code ;)

Some sort of wrapper makes perfect sense for the sendmail option -
I did think of this, but your right, it is best to assume the
"user-friendly" approach
and not give users tweaking to do out of the box.

Could be a possibilty of adding it as a switch / option to pw(8), with
NIS capabilities? (Rewritten in C of course) Would this be deemed useful
and anyone happy to review a patch?

Jamie

On 2001.05.09 08:30 Sean Winn wrote:
> At 04:32  8/05/01 +0100, you wrote:
> 
> > >Number:         27205
> > >Category:       bin
> > >Synopsis:       Listing all users in the passwd file
> > >Confidential:   no
> > >Severity:       non-critical
> > >Priority:       low
> > >Responsible:    freebsd-bugs
> > >State:          open
> > >Quarter:
> > >Keywords:
> > >Date-Required:
> > >Class:          change-request
> > >Submitter-Id:   current-users
> > >Arrival-Date:   Tue May 08 08:40:00 PDT 2001
> > >Closed-Date:
> > >Last-Modified:
> > >Originator:     Jamie Heckford
> > >Release:        FreeBSD 4.2-STABLE i386
> > >Organization:
> >Psi-Domain Limited
> > >Environment:
> >
> >FreeBSD storm.psi-domain.co.uk 4.2-STABLE FreeBSD 4.2-STABLE #2: Fri 
> >Mar  2 10:32:25 GMT 2001
> >
> > >Description:
> >
> >I was recently trying to discover a way of getting a list of all users
> on
> >one of my systems, and could not find an easy way to do it.
> >
> >I discovered the following awk script that prints out all users on the
> system
> >(from /etc/passwd). (Courtesy of sendmail.org)
> >
> >awk -F: '$3 > 100 { print $1 }' /etc/passwd
> >
> >Which will print out a list of all users in the passwd file wuth a UID
> greater
> >than 100.
> >
> >Could this be turned into a command such as "userlist", and/or would it
> be
> >deemed usefull?
> 
> Not particularly, as it doesn't work with NIS, and won't work with 
> nsswitch.conf.
> 
> A small perl script or C program using getpwent() in a loop is more 
> effective, as it takes into account both NIS and nsswitch.conf
> 
> 
> 
> 
> >Another good feature that many people get stuck on is for sending email
> to
> >all users on the system. Maybe it could be included as part of the
> sendmail
> >distro, with something like:
> >
> >awk -F: '$3 > 100 { print $1 }' /etc/passwd > /etc/mail/allusers
> 
> Note: it also picks up 'nobody'
> 
> >and put in cron.daily.
> >
> >This could then be a default in /etc/mail/aliases:
> >
> >allusers:       :include:/etc/mail/allusers
> >
> >What do you think? :)
> 
> Sure. Give spammers one address to email *everyone* on your system in one
> 
> fell swoop...
> 
> In itself, it's a bad default; I'd use a small script that actually
> checks 
> the source address (yes, easily forged, but rarely done on incoming spam)
> 
> before sending out the email to all users.
> 
> In fact, that's what I do...
> 
> (http://www.gothic.net.au/dist/allusers.c)
> 
> The domain and group are hardcoded, but easy enough to change.
> 
> >Jamie
> >
> >
> > >How-To-Repeat:
> >
> >userlist
> >--------
> >
> >awk -F: '$3 > 100 { print $1 }' /etc/passwd
> >
> >Sendmail
> >-------
> >
> >awk -F: '$3 > 100 { print $1 }' /etc/passwd > /etc/mail/allusers
> >echo "allusers:   :include:/etc/mail/allusers" >> /etc/aliases ;
> newaliases
> >echo "#\!/bin/sh" > /etc/periodic/daily/350.allusers
> >echo "awk -F: '$3 > 100 { print $1 }' /etc/passwd > /etc/mail/allusers"
> >> 
> >/etc/periodic/daily/350.allusers
> >chmod 0755 /etc/periodic/daily/350.allusers
> >
> > >Fix:
> >
> >Tested the above and worked fine, just need someone to tell me its great
> >or completly useless! :)
> >
> > >Release-Note:
> > >Audit-Trail:
> > >Unformatted:
> >
> >To Unsubscribe: send mail to majordomo@FreeBSD.org
> >with "unsubscribe freebsd-bugs" in the body of the message
> 
> 
> 
-- 
Jamie Heckford
Network Operations Manager
Psi-Domain - Innovative Linux Solutions. Ask Us How.

FreeBSD - The power to serve

Join our mailing list and stay informed by emailing
majordomo@psi-domain.co.uk with the line:
subscribe collective

=====================================
email:  heckfordj@psi-domain.co.uk
web:    http://www.psi-domain.co.uk/

tel:    +44 (0)1737 789 246
fax:    +44 (0)1737 789 245
mobile: +44 (0)7866 724 224 

=====================================


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




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