This commit is contained in:
Douglas Barone 2023-03-02 10:27:13 -04:00
parent cabeaafab5
commit 53bc27a6f4

View File

@ -33,6 +33,12 @@ while IFS="" read -r p || [ -n "$p" ]; do
continue
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
if ! samba-tool user show $USERNAME >/dev/null 2>&1; then
echo "User $USERNAME do not exists"