From owner-freebsd-questions Tue Jan 7 11: 9:15 2003 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 9F28437B405 for ; Tue, 7 Jan 2003 11:09:11 -0800 (PST) Received: from mired.org (ip68-97-54-220.ok.ok.cox.net [68.97.54.220]) by mx1.FreeBSD.org (Postfix) with SMTP id 6115843E4A for ; Tue, 7 Jan 2003 11:09:06 -0800 (PST) (envelope-from mwm-dated-1042398533.f8c466@mired.org) Received: (qmail 98615 invoked from network); 7 Jan 2003 19:08:53 -0000 Received: from localhost.mired.org (HELO guru.mired.org) (127.0.0.1) by localhost.mired.org with SMTP; 7 Jan 2003 19:08:53 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15899.9669.36074.518050@guru.mired.org> Date: Tue, 7 Jan 2003 13:08:53 -0600 To: Lauri Laupmaa Cc: questions@freebsd.org Subject: Re: creating user dirs In-Reply-To: <6FDBFE65-2235-11D7-8967-0003931E3224@minut.ee> References: <6FDBFE65-2235-11D7-8967-0003931E3224@minut.ee> X-Mailer: VM 7.07 under 21.1 (patch 14) "Cuyahoga Valley" XEmacs Lucid X-face: "5Mnwy%?j>IIV\)A=):rjWL~NB2aH[}Yq8Z=u~vJ`"(,&SiLvbbz2W`; h9L,Yg`+vb1>RG% *h+%X^n0EZd>TM8_IB;a8F?(Fb"lw'IgCoyM.[Lg#r\ From: Mike Meyer X-Delivery-Agent: TMDA/0.67 (Whirlaway) Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG In <6FDBFE65-2235-11D7-8967-0003931E3224@minut.ee>, Lauri Laupmaa typed: > Hi > > Is there a simple solution for creating all user directories under > /home ? > So, I have clean /home filesystem and hundreds of users in /etc/*passwd > Hopefully there is some simple command or script :) You can get the list from /etc/password easily enough with awk. I'd do: USERS=$(awk -F: '$3 > 999 { print $1 }' | grep -v nobody) which assumes you follow the convention of new users being above 1000. Given that list, you can easily create the directories: cd /home for user in $(awk -F: '$3 > 999 { print $1 }' | grep -v nobody) do mkdir $user # Copy whatever else you want into place, say /etc/skel/.* chown -R $user $user done http://www.mired.org/consulting.html Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message