#!/bin/bash # # 0.3 - wattersm@example.com # # $1 - username # $2 - password # $3 - email # $4 - full name # $5 - quota size in megabytes SETUPPARTITION="/home" # Calculate the quota properly. GIGABLOCK is the number of 1024K blocks # in one gigabyte. GIGABLOCK=1048576 die() { echo -e "$1" 1>&2 exit 255 } function tolower { echo "$1" | tr '[A-Z]' '[a-z]' } [ $# -eq 5 ] && [ -n "$1" ] && [ -n "$2" ] && [ -n "$3" ] && [ -n "$4" ] && [ -n "$5" ] || die "Usage $0 " echo "Setting up user with ${5}G quota ..." adduser -p $(perl -e "print crypt('$2','echo $RANDOM|cut -c 1-2');") -s /sbin/nologin -d $SETUPPARTITION/$1 $1 QLIMIT=$(echo "${GIGABLOCK}*${5}" | bc) setquota $1 ${QLIMIT} ${QLIMIT} 0 0 $SETUPPARTITION echo "Done" echo "Sending welcome message..." mail -s "Example Web Backup Network Account Information" $3 << EOF To: $3 Reply-To: support@example.com Subject: Example Web Backup Network Account Information Hello $4, Your Example Web Remote Backup Network account has been created. Please use the following information to log in: Server Name : `hostname` IP Address : `ifconfig eth1|grep inet|cut -d : -f 2|cut -d " " -f 1` FTP UserName : $1 Password : $2 All access is provided through FTP. Please note that you may only access to your remote backup account from your Example Web server. You cannot access the server from outside of our network. Also note that your server will have a10.x.x.x IP address on it. This is the IP address of the network card for the backup network. Do not assign this IP to any user accounts, nameservers, etc. It is for the backup network only and is not routeable on the Internet. If you have a backup drive in your server, it is strongly recommended that you use the backup drive for your backups in WebHostManager, and you use the remote backup server to keep another copy of your important files. When using FTP backups in WHM rather than a backup drive you cannot backup all of the server configuration files, you can only backup user accounts (web files, databases, email addresses, settings, etc.). There is also more backup space available on a backup drive than the remote backup server, and it is much quicker to restore accounts and settings from a backup drive than it is from the remote backup server in case of primary drive failure. If your server has a backup drive, it is already configured to backup to your backup hard drive nightly, weekly, and monthly. If you change it over to FTP backups, it will no longer perform backups to the backup drive and only perform backups through FTP. If you still wish to enable automatic FTP backups in your WHM, you may do so by following these steps: 1. Log into your WHM 2. Click on "Configure Backup" on the left-side menu. 3. Change Backup Type to "Remote Ftp Server (Accounts Only)" 4. Enter the IP Address in "FTP Backup Host" and your Username and Password in "Ftp Backup User" and "Ftp Backup Pass" 5. Leave "Ftp Backup Directory/Path" blank. 6. Leave "Use Passive mode for Ftp transfers" set to disabled. 7. Click on Save. If you have any questions, please contact our support team at support@example.com. EOF