Date: Tue, 7 Jan 2003 13:08:53 -0600 From: Mike Meyer <mwm-dated-1042398533.f8c466@mired.org> To: Lauri Laupmaa <mauri@minut.ee> Cc: questions@freebsd.org Subject: Re: creating user dirs Message-ID: <15899.9669.36074.518050@guru.mired.org> In-Reply-To: <6FDBFE65-2235-11D7-8967-0003931E3224@minut.ee> References: <6FDBFE65-2235-11D7-8967-0003931E3224@minut.ee>
next in thread | previous in thread | raw e-mail | index | archive | help
In <6FDBFE65-2235-11D7-8967-0003931E3224@minut.ee>, Lauri Laupmaa <mauri@minut.ee> 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
<mike
--
Mike Meyer <mwm@mired.org> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?15899.9669.36074.518050>
