Adduser.sh

From Edgar BV Wiki
Revision as of 14:22, 19 June 2019 by Red (talk | contribs) (Created page with "<pre> #!/bin/sh # Script to add users to sites # # 30 03 2009 # changed for apache2 # # 15 09 2006 # Useage ./adduser.sh sitename.ext user pass # NB NO WWW before sitename.ex...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
#!/bin/sh

# Script to add users to sites
#
# 30 03 2009
# changed for apache2
#
# 15 09 2006
# Useage ./adduser.sh sitename.ext user pass
# NB NO WWW before sitename.ext!!!
# NB2 This script doesn't add the user to /etc/postfix/virtual
#
# 22 04 2009
# Creates empty files with the right permissions in /home/spool/mail

SITENAME=$1
USER=$2
PASS=$3
GROUPNAME=`grep $SITENAME /etc/apache2/listvirts | awk -F '- '  '{ print $2}'`

/usr/sbin/useradd -s /bin/false -g $GROUPNAME -m -d /home/sites/www.$SITENAME/users/$USER $USER
echo "$USER:$PASS" > userpasslist
cat ./userpasslist | /usr/sbin/chpasswd
cat /dev/null > userpasslist

touch /var/spool/mail/$USER
chown $USER:$GROUPNAME /var/spool/mail/$USER
exit