samba.sh don't try to add a group if one isn't given
This commit is contained in:
parent
f42fb1fa2b
commit
76dacf8ce6
2
samba.sh
2
samba.sh
@ -109,7 +109,7 @@ timezone() { local timezone="${1:-EST5EDT}"
|
|||||||
# id) for user
|
# id) for user
|
||||||
# Return: user added to container
|
# Return: user added to container
|
||||||
user() { local name="${1}" passwd="${2}" id="${3:-""}" group="${4:-""}"
|
user() { local name="${1}" passwd="${2}" id="${3:-""}" group="${4:-""}"
|
||||||
grep -q "^$group:" /etc/group || groupadd "$group"
|
[[ "$group" ]] && { grep -q "^$group:" /etc/group || groupadd "$group"; }
|
||||||
useradd "$name" -M ${id:+-u $id} ${group:+-g $group}
|
useradd "$name" -M ${id:+-u $id} ${group:+-g $group}
|
||||||
echo -e "$passwd\n$passwd" | smbpasswd -s -a "$name"
|
echo -e "$passwd\n$passwd" | smbpasswd -s -a "$name"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user