Add u if necessary
This commit is contained in:
parent
53bc27a6f4
commit
8d12d96bb3
|
@ -8,6 +8,12 @@ if [ -z "$USERNAME" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Check if $USERNAME starts with a number
|
||||||
|
if [[ $USERNAME =~ ^[0-9] ]]; then
|
||||||
|
echo "Username cannot start with a number. Appending 'u' to the beginning of the username..."
|
||||||
|
USERNAME="u$USERNAME"
|
||||||
|
fi
|
||||||
|
|
||||||
# Check if user exists
|
# Check if user exists
|
||||||
if ! samba-tool user show $USERNAME >/dev/null 2>&1; then
|
if ! samba-tool user show $USERNAME >/dev/null 2>&1; then
|
||||||
echo "User $USERNAME does not exist"
|
echo "User $USERNAME does not exist"
|
||||||
|
|
|
@ -10,6 +10,12 @@ if [ -z "$USERNAME" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Check if $USERNAME starts with a number
|
||||||
|
if [[ $USERNAME =~ ^[0-9] ]]; then
|
||||||
|
echo "Username cannot start with a number. Appending 'u' to the beginning of the username..."
|
||||||
|
USERNAME="u$USERNAME"
|
||||||
|
fi
|
||||||
|
|
||||||
# Check if $USERNAME exists
|
# Check if $USERNAME exists
|
||||||
if ! samba-tool user show $USERNAME >/dev/null 2>&1; then
|
if ! samba-tool user show $USERNAME >/dev/null 2>&1; then
|
||||||
echo "User $USERNAME do not exists"
|
echo "User $USERNAME do not exists"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user