Re: [Fedora] Re: Separate shell and www servers...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

#!/bin/bash
#
# usernew v.0.1
# Rodolfo J. Paiz <rpaiz@xxxxxxxxxxxxxx>
# Last Changed: 2004.08.17

if [ incorrect command-line parameters given ] ; then
   print help and usage message
   exit 1
fi

USERNAME=$0
REALNAME=$1
PASSWORD=$2

useradd -c $realname $username
echo $password | passwd --stdin

mkdir /usr/www/bob
chown -R bob.bob /usr/www/bob
ln -s /usr/www/bob /home/bob/www

# EOF

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.

Cheers,

-- 
Rodolfo J. Paiz <rpaiz@xxxxxxxxxxxxxx>
Simpaticus.com



[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux