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

Re: [Sheflug] skel



On Mon, 2003-06-16 at 22:53, fred wrote:
> done:
> 
> cd /etc/skel
> 
> md public_html
> 
> This will allow me to place any files that are needed such as .htaccess
> all I need is a way of updating htpasswd.users file!
> 
> thanks 
> 
> fred dodd

Is this something like you need?

#!/bin/sh
ARGS=$#;
for ((a=1; a <= ARGS ; a++))
do
  useraddargs="$useraddargs$1 ";
  user="$1";      # the user must be last argument
  shift;
done
/usr/sbin/useradd $useraddargs
homedir=`cat /etc/passwd | grep "^$user" | awk -F: {'print $6;'}`;
cat /etc/shadow | grep "^$user" | awk -F: {'print $1":"$2'} >$homedir/.htpasswd


Called with the same arguments you would use for regular useradd (the
only restriction is that the username is the last argument). 
The script then looks in /etc/shadow for the password of the users
one-way hash, and then places it in a .htpasswd within their homedir.

You could even move /usr/sbin/useradd to /usr/sbin/useradd_unix, and
then make this script /usr/sbin/useradd- if you really need
transparency.

-- 
Regards,
Adam Allen.

adam@dynamicinteraction.co.uk
pgp http://search.keyserver.net:11371/pks/lookup?op=vindex&search=adam%40dynamicinteraction.co.uk

Attachment: signature.asc
Description: This is a digitally signed message part