mobile logo

scripts There are 1 posts in this category

1

While working on a postfix/dovecot non-mysql virtual domain configuration, I needed a simple admin script to add new users. The script below is what I came up with after about 30 minutes. I was unable to find something that met my needs on the interweb, so I hope this post finds someone else in need! Please submit bugs/suggestions to: nick.wilkens@mnxsolutions.com [code] #!/bin/bash # bugs/suggestions to: nick.wilkens@mnxsolutions.com # 1/29/2012 USERSFILE=/etc/dovecot/users POSTFIXVIRTUAL_MAILBOX=/etc/postfix/virtual_mailbox_maps POSTFIXVIRTUAL_DOMAINS=/etc/postfix/virtual_domains function validate_username() { username=$1 echo $username| egrep -iq '([[:alnum:]_.]+@[[:alnum:]_]+?.[[:alpha:].]{2,6})'; RC=$? if [ ${RC} -ne 0 ] then echo "Invalid username, please ensure user@domain.tld format ($RC)" exit 1 fi } function get_username() …

Read More