Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 09 Dec 1999 08:58:14 -0500
From:      "N.B. DelMore" <mylists@inr.net>
To:        jill@securify.com
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: pw problem- can't get it to work
Message-ID:  <3.0.6.32.19991209085814.00a01580@mail.inr.net>
In-Reply-To: <384F0D99.492DD70@securify.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Jill, Here is the script we use to add users, their password etc., you will
probably want to modify it to suit your needs.  BTW, 'replicate' is just a
script run by cron to copy various configuration files between servers, in
this case the aliases file gets sent to our old mail server which is
currently defined as mx1 in our dns.  We use a similar script to delete users.

Regards
Noel

-----------------------------------------------------------------------------

#!/bin/sh

# Script : usera v1.0
# Usage  : usera <uname> <passwd> <fname> <lname> <account>
# Author : N.B. Del More - nbd@inr.net
# Notes  : This script sets up accounts for our users

# Let's define some variables

# username
uname=$1
# password
passwd=$2
# First (given) Name
fname=$3
# Last (surname) Name
lname=$4
# Primary, 2nd, 3rd, 4th, etc. Email Account
account=$5
# Default directory for user
dir=/nonexistant
# Just needed to add a quote within a quote for some scripts, use as: ${DQ}
DQ='"'

# Test to see if the proper number of variables have been entered,
# if not display the proper usage of the script.

if [ $# -ne 5 ];then
        echo
        echo "usage: $0 <uname> <passwd> <fname> <lname> <account>"
        echo
        echo "uname   = username"
        echo "passwd  = password"
        echo "fname   = users first (given) name"
        echo "lname   = users last (surname) name"
        echo "account = Primary, 2nd, 3rd, 4th etc."
        exit 0
fi

echo "$passwd" | pw useradd $uname -c "$fname $lname,,$account Email" -h 0
-d $dir

# set quota for mail service to 10 Mb per account
edquota -p user10 $uname

# add the user to the aliases file, needed until we can move all customers
to the
# new mail server.
echo "$uname:   $uname@mail.inr.net" >> /etc/mail/aliases.master

# trigger replicate
touch /etc/mail/replicate_me

# Clean it up
rm -f /tmp/usera.$uname
rm -f /tmp/billing.$uname

# For the heck of it ... tell me what you did when I blinked
echo ""
echo "The $account Email Account For $fname $lname"
echo "Email Account:  $uname"
echo "Password     :  $passwd"
echo "Alias        :  $uname:   $uname@mail.inr.net"
echo "Has been created"
echo ""



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3.0.6.32.19991209085814.00a01580>