Merge pull request #11 from JANorman/feature/admin-users
LGTM, thanks for the addition.
This commit is contained in:
commit
fb323d858c
@ -41,6 +41,7 @@ OR set local storage:
|
|||||||
[readonly] default:'yes' or 'no'
|
[readonly] default:'yes' or 'no'
|
||||||
[guest] allowed default:'yes' or 'no'
|
[guest] allowed default:'yes' or 'no'
|
||||||
[users] allowed default:'all' or list of allowed users
|
[users] allowed default:'all' or list of allowed users
|
||||||
|
[admins] allowed default:'none' or list of admin users
|
||||||
-t "" Configure timezone
|
-t "" Configure timezone
|
||||||
possible arg: "[timezone]" - zoneinfo timezone for container
|
possible arg: "[timezone]" - zoneinfo timezone for container
|
||||||
-u "<username;password>" Add a user
|
-u "<username;password>" Add a user
|
||||||
|
6
samba.sh
6
samba.sh
@ -37,9 +37,10 @@ import() { local name id file="${1}"
|
|||||||
# readonly) 'yes' or 'no'
|
# readonly) 'yes' or 'no'
|
||||||
# guest) 'yes' or 'no'
|
# guest) 'yes' or 'no'
|
||||||
# users) list of allowed users
|
# users) list of allowed users
|
||||||
|
# admins) list of admin users
|
||||||
# Return: result
|
# Return: result
|
||||||
share() { local share="$1" path="$2" browse=${3:-yes} ro=${4:-yes}\
|
share() { local share="$1" path="$2" browse=${3:-yes} ro=${4:-yes}\
|
||||||
guest=${5:-yes} users=${6:-""} file=/etc/samba/smb.conf
|
guest=${5:-yes} users=${6:-""} admins=${7:-"none"} file=/etc/samba/smb.conf
|
||||||
sed -i "/\\[$share\\]/,/^\$/d" $file
|
sed -i "/\\[$share\\]/,/^\$/d" $file
|
||||||
echo "[$share]" >>$file
|
echo "[$share]" >>$file
|
||||||
echo " path = $path" >>$file
|
echo " path = $path" >>$file
|
||||||
@ -48,6 +49,8 @@ share() { local share="$1" path="$2" browse=${3:-yes} ro=${4:-yes}\
|
|||||||
echo " guest ok = $guest" >>$file
|
echo " guest ok = $guest" >>$file
|
||||||
[[ ${users:-""} && ! ${users:-""} =~ all ]] &&
|
[[ ${users:-""} && ! ${users:-""} =~ all ]] &&
|
||||||
echo " valid users = $(tr ',' ' ' <<< $users)" >>$file
|
echo " valid users = $(tr ',' ' ' <<< $users)" >>$file
|
||||||
|
[[ ${admins:-""} && ! ${admins:-""} =~ none ]] &&
|
||||||
|
echo " admin users = $(tr ',' ' ' <<< $admins)" >>$file
|
||||||
echo -e "" >>$file
|
echo -e "" >>$file
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,6 +100,7 @@ Options (fields in '[]' are optional, '<>' are required):
|
|||||||
[readonly] default:'yes' or 'no'
|
[readonly] default:'yes' or 'no'
|
||||||
[guest] allowed default:'yes' or 'no'
|
[guest] allowed default:'yes' or 'no'
|
||||||
[users] allowed default:'all' or list of allowed users
|
[users] allowed default:'all' or list of allowed users
|
||||||
|
[admins] allowed default:'none' or list of admin users
|
||||||
-t \"\" Configure timezone
|
-t \"\" Configure timezone
|
||||||
possible arg: \"[timezone]\" - zoneinfo timezone for container
|
possible arg: \"[timezone]\" - zoneinfo timezone for container
|
||||||
-u \"<username;password>\" Add a user
|
-u \"<username;password>\" Add a user
|
||||||
|
Loading…
Reference in New Issue
Block a user