samba.sh/README.md - Add support for setting the USERID and GROUPID #40

This commit is contained in:
David Personette 2017-01-04 15:54:52 -05:00
parent b080e5c373
commit f42fb1fa2b
2 changed files with 5 additions and 0 deletions

View File

@ -67,6 +67,8 @@ ENVIRONMENT VARIABLES (only available with `docker run`)
* `NMBD` - As above, enable nmbd * `NMBD` - As above, enable nmbd
* `TZ` - As above, set a zoneinfo timezone, IE `EST5EDT` * `TZ` - As above, set a zoneinfo timezone, IE `EST5EDT`
* `WORKGROUP` - As above, set workgroup * `WORKGROUP` - As above, set workgroup
* `USERID` - Set the UID for the samba server
* `GROUPID` - Set the GID for the samba server
**NOTE**: if you enable nmbd (via `-n` or the `NMBD` environment variable), you **NOTE**: if you enable nmbd (via `-n` or the `NMBD` environment variable), you
will also want to expose port 137 and 138 with `-p 137:137/udp -p 138:138/udp`. will also want to expose port 137 and 138 with `-p 137:137/udp -p 138:138/udp`.

View File

@ -164,6 +164,9 @@ The 'command' (if provided and valid) will be run instead of samba
exit $RC exit $RC
} }
[[ "${USERID:-""}" =~ ^[0-9]+$ ]] && usermod -u $USERID -o smbuser
[[ "${GROUPID:-""}" =~ ^[0-9]+$ ]] && groupmod -g $GROUPID -o users
while getopts ":hc:i:nps:t:u:w:" opt; do while getopts ":hc:i:nps:t:u:w:" opt; do
case "$opt" in case "$opt" in
h) usage ;; h) usage ;;