From owner-freebsd-questions@FreeBSD.ORG Fri Sep 24 15:51:38 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 E615B16A6DD for ; Fri, 24 Sep 2004 15:51:37 +0000 (GMT) Received: from post5.inre.asu.edu (post5.inre.asu.edu [129.219.110.120]) by mx1.FreeBSD.org (Postfix) with ESMTP id B2C0943D53 for ; Fri, 24 Sep 2004 15:51:37 +0000 (GMT) (envelope-from David.Bear@asu.edu) Received: from conversion.post5.inre.asu.edu by asu.edu (PMDF V6.1-1X6 #30769) id <0I4J00B01YK1DJ@asu.edu> for questions@FreeBSD.ORG; Fri, 24 Sep 2004 08:48:01 -0700 (MST) Received: from smtp.asu.edu (smtp.asu.edu [129.219.110.107]) <0I4J009I3YK1VB@asu.edu>; Fri, 24 Sep 2004 08:48:01 -0700 (MST) Received: from moroni.pp.asu.edu (moroni.pp.asu.edu [129.219.69.200]) (8.12.10/8.12.10/asu_smtp_relay,nullclient,tcp_wrapped) with ESMTP id i8OFls71014150; Fri, 24 Sep 2004 08:47:54 -0700 (MST) Received: by moroni.pp.asu.edu (Postfix, from userid 500) id 98BE3E4B; Fri, 24 Sep 2004 08:47:16 -0700 (MST) Received: from post1.inre.asu.edu (post1.inre.asu.edu [129.219.110.72]) by imap1.asu.edu (8.11.0/8.11.0/asu_cyrus,tcp_wrapped) with ESMTP id h08Hv5i17115 for ; Wed, 08 Jan 2003 10:57:05 -0700 (MST) Received: from conversion.post1.inre.asu.edu by asu.edu (PMDF V6.1 #40110) david.bear@asu.edu) ; Wed, 08 Jan 2003 10:57:05 -0700 (MST) Received: from mx2.freebsd.org (mx2.freebsd.org [216.136.204.119]) by asu.edu (PMDF V6.1 #40110) with ESMTP id <0H8E00277PV42Q@asu.edu> for iddwb@IMAP1.ASU.EDU (ORCPT david.bear@asu.edu); Wed, 08 Jan 2003 10:57:05 -0700 (MST) Received: from hub.freebsd.org (hub.freebsd.org [216.136.204.18]) by mx2.freebsd.org (Postfix) with ESMTP id C410655995; Wed, 08 Jan 2003 09:57:02 -0800 Received: by hub.freebsd.org (Postfix, from userid 538) id A248337B405; Wed, 08 Jan 2003 09:57:00 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by hub.freebsd.org (Postfix) with SMTP id 868362E800D; Wed, 08 Jan 2003 09:57:00 -0800 (PST) Received: by hub.freebsd.org (bulk_mailer v1.12); Wed, 08 Jan 2003 09:57:00 -0800 Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1258437B401 for ; Wed, 08 Jan 2003 09:56:59 -0800 (PST) Received: from shell.siscom.net (shell.siscom.net [209.251.2.80]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3AE0943EE6 for ; Wed, 08 Jan 2003 09:56:58 -0800 Received: from shell.siscom.net (vogelke@localhost [127.0.0.1]) by shell.siscom.net (8.12.3/8.12.3) with ESMTP id h08Hun7g062072; Wed, 08 Jan 2003 12:56:49 -0500 Received: (from vogelke@localhost) by shell.siscom.net (8.12.3/8.12.3/Submit) id h08HumLB062071; Wed, 08 Jan 2003 12:56:48 -0500 (EST) Received: (qmail 29228 invoked by alias); Wed, 08 Jan 2003 12:56:07 -0500 Received: (qmail 29210 invoked by uid 583); Wed, 08 Jan 2003 12:56:06 -0500 From: Karl Vogel In-reply-to: <6FDBFE65-2235-11D7-8967-0003931E3224@minut.ee> Sender: owner-freebsd-questions@FreeBSD.ORG To: dwbear75@gmail.com Message-id: <20030108175606.29209.qmail@kev.wpafb.af.mil> Organization: Sumaria Systems Inc. Precedence: bulk X-Loop: FreeBSD.ORG Delivered-to: alias-outgoing-mauri@minut.ee Old-To: mauri@minut.ee X-Disclaimer: I don't speak for the USAF or Sumaria. X-PGP-ID: 1024/D558F237 1999/04/06 Karl Vogel X-PGP-Fingerprint: 8DF5 1D90 18EC A9EF 9EA6 4611 35F4 BC78 D558 F237 Lines: 43 cc: questions@FreeBSD.ORG Subject: Re: creating user dirs X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Date: Fri, 24 Sep 2004 15:51:38 -0000 X-Original-Date: Wed, 08 Jan 2003 12:56:06 -0500 X-List-Received-Date: Fri, 24 Sep 2004 15:51:38 -0000 >> 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 -- Karl Vogel I don't speak for the USAF or my company vogelke@pobox.com http://www.pobox.com/~vogelke If all the veins in your body were laid end to end, you'd be dead. --unknown To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message