specialized subdirectory

Stuart Sears stuart at sjsears.com
Wed Jul 7 18:43:21 UTC 2004


On Wednesday 07 July 2004 17:29, j.travis wrote:
> I would like to create a specialized subdirectory whenever useradd is
> invoked.  More specifically:
>
> for a user:          user1
> with a home directory:     /home/share
>
> I would like to automatically create:
>
> /home/share/.user1-mail/
>
> when I issue:
>
> useradd -d /home/share user1
>
> I have been looking through the files in /etc/profile /etc/skel /etc/bashrc
> and whatnot but haven't found the right spot yet.  Any ideas?
have you considered simply writing a shell script to do this for you?
e.g.
(off the top of my head, so apologies for clumsiness)
e.g /root/bin/users.sh
# --begin--#
#!/bin/bash
for user in $*
do
useradd -d /home/share $user
install -o $user -g (users primary group) -d /home/share/.$user-mail
done
# -- end

and call it with 
users.sh user1 user2 user3 user4 (etc etc)

if you don't like the install command, you can always replace it with mkdir 
and chown

I assume your setup means that all your users share the same primary group?

Stuart
--
Stuart Sears RHCE, RHCX





More information about the redhat-list mailing list