[Fedora] Re: Separate shell and www servers...
Rodolfo J. Paiz
rpaiz at simpaticus.com
Tue Aug 17 17:12:16 UTC 2004
On Tue, 2004-08-17 at 09:18, Ashley M. Kirchner wrote:
> However, how do you deal with automatic user creation, and assigning
> permissions to, say /usr/www/bob? When you use useradd to add a new
> user, it only assigns permissions to the $HOME directory. As far as I
> can see, I'd have to manually go create /usr/www/bob, and chown it to
> user bob.
You script it, that's how. Note that the following is "pseudo-code" and
will need work, but it should give you a rough general idea.
# usernew v.0.1
# Rodolfo J. Paiz <rpaiz at simpaticus.com>
# Last Changed: 2004.08.17
if [ incorrect command-line parameters given ] ; then
print help and usage message
useradd -c $realname $username
echo $password | passwd --stdin
chown -R bob.bob /usr/www/bob
ln -s /usr/www/bob /home/bob/www
Lots of other stuff you can do, too. Anything you can do at the command
line, you can pretty quickly script with the shell. I would attempt to
make sure that this script is *not* interactive and gets its parameters
from the command-line, since then I could also quickly write another
script to go through a properly formatted array or text file and create
any number of users at will with very little work.
Rodolfo J. Paiz <rpaiz at simpaticus.com>
More information about the users