Date: Fri, 24 Sep 2004 11:17:26 -0500 From: Chris <racerx@makeworld.com> To: Karl Vogel <vogelke@pobox.com> Cc: dwbear75@gmail.com Subject: Re: creating user dirs Message-ID: <41544896.5020305@makeworld.com> In-Reply-To: <20030108175606.29209.qmail@kev.wpafb.af.mil> References: <20030108175606.29209.qmail@kev.wpafb.af.mil>
next in thread | previous in thread | raw e-mail | index | archive | help
Karl Vogel wrote:
>>>On Tue, 7 Jan 2003 13:44:53 +0200,
>>>Lauri Laupmaa <mauri@minut.ee> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?41544896.5020305>
