username can be between 3 and 12 characters
This commit is contained in:
parent
e4e4d4e47a
commit
c463be70a2
|
@ -37,7 +37,7 @@ if [[ -d /srv/www/$domain ]] || [[ -f /etc/apache2/sites-available/$domain.conf
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# check for and set username
|
||||
# check for and set username (length between 3 and 12 characters)
|
||||
if [[ -z "$username" ]]; then
|
||||
strippeddomain=`echo $domain | sed 's|\.||'`
|
||||
strippeddomain=`echo $strippeddomain | sed 's|-||'`
|
||||
|
@ -64,8 +64,19 @@ if [[ -z "$username" ]]; then
|
|||
# username already exists, try another
|
||||
username=`echo ${strippeddomain:0:12}`
|
||||
if grep -q "^$username:" /etc/passwd; then
|
||||
echo "trouble setting unique username, specify '-u USERNAME' to use an existing username"
|
||||
exit 1
|
||||
# username already exists, try another
|
||||
username=`echo ${strippeddomain:0:4}`
|
||||
if grep -q "^$username:" /etc/passwd; then
|
||||
# username already exists, try another
|
||||
username=`echo ${strippeddomain:0:3}`
|
||||
if grep -q "^$username:" /etc/passwd; then
|
||||
# username already exists, try another
|
||||
if grep -q "^$username:" /etc/passwd; then
|
||||
echo "trouble setting unique username, specify '-u USERNAME' to use an existing username"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue
Block a user