On Thu, Oct 21, 2010 at 7:00 PM, Nilesh Govindarajan <[email protected]>wrote:

> On Thu, Oct 21, 2010 at 12:08 AM, Narendra Sisodiya
> <[email protected]> wrote:
> > I want that while remixing distro, when new user is added, his directory
> > should be added at /var/www/<username> and he should get a Folder in home
> > diretory called public-html which is basically a shortlink to
> > /var/www/<user-name>.
> > This will help user to immediate launching his html stuff without going
> to
> > terminal and create these stuff..
> > I am also reading adduser script.
> >
> > PS:  see    /var/www/  as /var/www/html if you use fedora
> > --
> > ┌─────────────────────────┐
> > │    Narendra Sisodiya
> > │    http://narendrasisodiya.com
> > └─────────────────────────┘
> >
>
> There's a cron daemon called incrond,which watches paths specified in
> the incrontab.
> When there's some change (kernel-inotify event), it will run the
> specified script.
>
> A script something like this can be created:
>
> #!/bin/bash
>
> # check if username is passed as first arg, else exit
>
> [ ! $!1 ] && exit 1;
>
> pth=/var/www/$1
>
> # create /var/www/username
>
> mkdir $pth
>
> # change ownership of /var/www/username to username:username
>
> chown $1:$1 -R $pth
>
> # put link to /var/www/username in /home/username/public_html
>
> ln -s $pth /home/username/public_html
>
> The incrontab of root:
>
> /var/www IN_CREATE /path/to/our/bash/script $#
>
> *NOTE: This is one way to do, there may be some other to do also,
> using custom adduser/useradd scripts*
>
>
Thanks, nice info... Will workout on this.

-- 
l...@iitd - http://tinyurl.com/ycueutm

Reply via email to