#!/bin/sh
# smbuser.sh
# 2021-02-15
# by Gernot WALZL
# Samba user management
print_usage () {
echo "Usage: $0 {add|del|list} [LOGIN]"
}
add_user () {
local LOGIN="$1"
if [ -z "$LOGIN" ]; then
return 1
fi
smbpasswd -a "$LOGIN"
}
del_user () {
local LOGIN="$1"
if [ -z "$LOGIN" ]; then
return 1
fi
smbpasswd -x "$LOGIN"
}
list_users () {
pdbedit -L
}
case "$1" in
'add')
add_user "$2"
;;
'del')
del_user "$2"
;;
'list')
list_users
;;
*)
print_usage
;;
esac