From owner-freebsd-bugs Tue May 8 8:40: 9 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 122C537B422 for ; Tue, 8 May 2001 08:40:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f48Fe1S57680; Tue, 8 May 2001 08:40:01 -0700 (PDT) (envelope-from gnats) Received: from rafiu.psi-domain.co.uk (rafiu.psi-domain.co.uk [212.87.84.199]) by hub.freebsd.org (Postfix) with ESMTP id 971D237B423 for ; Tue, 8 May 2001 08:36:35 -0700 (PDT) (envelope-from jamie@psi-domain.co.uk) Received: by rafiu.psi-domain.co.uk (Postfix, from userid 1001) id 9C4B5402EC6; Tue, 8 May 2001 16:32:02 +0100 (BST) Message-Id: <20010508153202.9C4B5402EC6@rafiu.psi-domain.co.uk> Date: Tue, 8 May 2001 16:32:02 +0100 (BST) From: jamie@psi-domain.co.uk Reply-To: jamie@psi-domain.co.uk To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: bin/27205: Listing all users in the passwd file Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >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? 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 and put in cron.daily. This could then be a default in /etc/mail/aliases: allusers: :include:/etc/mail/allusers What do you think? :) 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/350.allusers echo "awk -F: '$3 > 100 { print $1 }' /etc/passwd > /etc/mail/allusers" >> /etc/periodic/350.allusers chmod 0755 /etc/periodic/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