#!/bin/bash while read line; do user=$(echo "$line" | cut -d':' -f1) # only create user if doesn't exist if [[ -z $(getent passwd $user) ]]; then adduser "$user" --disabled-password --gecos "" --no-create-home --shell /usr/sbin/nologin usermod -a -G sambashare "$user" fi done < $1 # import passwords file pdbedit -i smbpasswd:$1