diff --git a/README.md b/README.md index 4ceb695..9f7f03e 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,8 @@ ENVIRONMENT VARIABLES (only available with `docker run`) * `NMBD` - As above, enable nmbd * `TZ` - As above, set a zoneinfo timezone, IE `EST5EDT` * `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 will also want to expose port 137 and 138 with `-p 137:137/udp -p 138:138/udp`. diff --git a/samba.sh b/samba.sh index c71753f..49648e9 100755 --- a/samba.sh +++ b/samba.sh @@ -164,6 +164,9 @@ The 'command' (if provided and valid) will be run instead of samba 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 case "$opt" in h) usage ;;