Created
August 21, 2012 12:47
-
-
Save t0d0r/3415094 to your computer and use it in GitHub Desktop.
bash script from mail.interbild.net
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # script name: mkmailuser | |
| # part of freebsd helpers | |
| # author todor dragnev aka t0d0r | |
| ## get command line | |
| user1=$1 | |
| password=$2 | |
| ip=$3 | |
| email=$4 | |
| date=`date +"%D %T"` | |
| user=`echo ${user1} | tr "[:upper:]" "[:lower:]"` | |
| if [ "$ip" = "" ]; then | |
| echo "Usage: $0 <username> <password> <ip> [option@email]" | |
| exit | |
| fi | |
| if [ -f /home/mail/$user ]; then | |
| echo "already have account with this login name." | |
| exit | |
| fi | |
| echo ${password} | pw useradd ${user} -h 0 -d /home/mail/${user} -m -g 200 -c "mailonly[${ip}]" -s /sbin/nologin || exit | |
| echo " | |
| ## username : $user | |
| ## ip : $ip | |
| ## date : $date | |
| ## email : $email | |
| " | tee > /home/mail/$user/create-mail.nfo | |
| finger $user |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment