From owner-freebsd-questions@FreeBSD.ORG Fri Sep 24 16:17:26 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2856216A4CF for ; Fri, 24 Sep 2004 16:17:26 +0000 (GMT) Received: from makeworld.com (makeworld.com [198.92.228.38]) by mx1.FreeBSD.org (Postfix) with ESMTP id CFFCE43D5E for ; Fri, 24 Sep 2004 16:17:25 +0000 (GMT) (envelope-from racerx@makeworld.com) Received: from localhost (localhost.com [127.0.0.1]) by makeworld.com (Postfix) with ESMTP id 0B2426381; Fri, 24 Sep 2004 11:17:25 -0500 (CDT) Received: from makeworld.com ([127.0.0.1]) by localhost (makeworld.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 13337-01; Fri, 24 Sep 2004 11:17:21 -0500 (CDT) Received: from [198.92.228.34] (racerx.makeworld.com [198.92.228.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by makeworld.com (Postfix) with ESMTP id 812EF6391; Fri, 24 Sep 2004 11:17:20 -0500 (CDT) Message-ID: <41544896.5020305@makeworld.com> Date: Fri, 24 Sep 2004 11:17:26 -0500 From: Chris User-Agent: Mozilla Thunderbird 0.7.3 (X11/20040923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Karl Vogel References: <20030108175606.29209.qmail@kev.wpafb.af.mil> In-Reply-To: <20030108175606.29209.qmail@kev.wpafb.af.mil> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by ClamAV 0.75.1/amavisd-new-2.1.1 at makeworld.com - Isn't it ironic cc: questions@FreeBSD.ORG cc: dwbear75@gmail.com Subject: Re: creating user dirs X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2004 16:17:26 -0000 Karl Vogel wrote: >>>On Tue, 7 Jan 2003 13:44:53 +0200, >>>Lauri Laupmaa said: > > > L> Is there a simple solution for creating all user directories under > L> /home? So, I have clean /home filesystem and hundreds of users in > L> /etc/*passwd. Hopefully there is some simple command or script :) > > Create a subset of the passwd file with the user, group, and home > directory only: > > # cut -f1,4,6 -d: /etc/passwd | grep /home/ | sed -e 's/:/ /g' > /tmp/pw > > Create the directory tree. You need the '-p' flag in mkdir if you > have multiple levels of directories under /home: > > # awk '{print "mkdir -p", $3}' /tmp/pw | sh > > Next, set permissions. Use 750 instead of 755 if you don't want > world read access to user's home directories: > > # awk '{print "chmod 755", $3}' /tmp/pw | sh > > If you want to populate the home directories with some default dot files > (.profile, etc) you can do something like > > # cd /etc/skel > # awk '{print "find . -print | cpio -pdum", $3}' /tmp/pw > > Finally, set ownerships. This assumes you want the user's home > directory and files owned by the user and the default user's group: > > # awk '{print "chown -R", $1"."$2, $3}' /tmp/pw | sh > # rm /tmp/pw > Someone better fix the system clock