On Sat, 17 Jan 2004 21:47:03 +1100
Phil Scarratt <[EMAIL PROTECTED]> wrote:

> Hi all
> 
> Just wondering what people come up with as far as the easiest way to 
> create a sub-directory under all users home directory with appropriate 
> permissions. In the order of 400 users, with approx 50 in one primary 
> group and the rest in another primary group. Permissions need to be 700.

700 means group is irrelevant so I'm not sure why you mention the group.

Anyway ...If they're all under /home, and the homedir name = username, then

 cd /home
 umask 077
 for f in *
 do
   mkdir $f/newdir
   chown -h $f $f/newdir
 done

Notes.
1. the mkdir could actually be before the loop,
i.e. mkdir */newdir, but that would fail if there
are many more then 400 users.
2. -h is important for chown to avoid symlink naughtiness by users.

--
Matt



-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to