In <[EMAIL PROTECTED]>, Lauri Laupmaa <[EMAIL PROTECTED]> 
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 <[EMAIL PROTECTED]>              http://www.mired.org/consulting.html
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message

Reply via email to