diff --git a/Dockerfile b/Dockerfile index e46c949..cb0f379 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,18 +13,11 @@ RUN set -eu && \ COPY --chmod=755 samba.sh /usr/bin/samba.sh COPY --chmod=664 smb.conf /etc/samba/smb.default +COPY --chmod=600 users.conf /etc/samba/users.conf VOLUME /storage EXPOSE 139 445 -ENV NAME="Data" -ENV USER="samba" -ENV PASS="secret" - -ENV UID=1000 -ENV GID=1000 -ENV RW=true - HEALTHCHECK --interval=60s --timeout=15s CMD smbclient --configfile=/etc/samba.conf -L \\localhost -U % -m SMB3 ENTRYPOINT ["/sbin/tini", "--", "/usr/bin/samba.sh"] diff --git a/readme.md b/README.md similarity index 84% rename from readme.md rename to README.md index 4f15bac..9f4a623 100644 --- a/readme.md +++ b/README.md @@ -12,6 +12,31 @@ Docker container of [Samba](https://www.samba.org/), an implementation of the Windows SMB networking protocol. +Original container forked from [dockur/samba](https://github.com/dockur/samba). + +This fork is configured to focus more on implementing a multi-user share using Samba homes shares. + +## TODO: +- [ ] Continue modifying container to further fit samba homes share +- [ ] Finish updating README.md + +## Building +Build with buildkit! + +Run: +`DOCKER_BUILDKIT=1 docker build . -t [registry:tag]` inside of this repository's directory. + +Or have the following configuration in your `daemon.json` +```json +{ + "features": { + "buildkit": true + } +} +``` +And build normally. + +For more information, refer to the [offical dockerdocs](https://docs.docker.com/build/buildkit/#getting-started) ## Usage 🐳 diff --git a/samba.sh b/samba.sh index 8af607c..b68a722 100644 --- a/samba.sh +++ b/samba.sh @@ -31,7 +31,7 @@ add_user() { # Check if the user already exists, if not, create it if ! id "$username" &>/dev/null; then [[ "$username" != "$USER" ]] && echo "User $username does not exist, creating user..." - adduser -S -D -H -h /tmp -s /sbin/nologin -G "$groupname" -u "$uid" -g "Samba User" "$username" || { echo "Failed to create user $username"; return 1; } + adduser -S -D -h /storage/"$username" -s /sbin/nologin -G "$groupname" -u "$uid" -g "Samba User" "$username" || { echo "Failed to create user $username"; return 1; } else # Check if the uid right,if not, change it local current_uid diff --git a/smb.conf b/smb.conf index e339043..d20339d 100644 --- a/smb.conf +++ b/smb.conf @@ -8,12 +8,14 @@ printcap name = /dev/null disable spoolss = yes -[Data] - path = /storage - comment = Shared - valid users = @smb - browseable = yes + disable netbios = yes + smb encrypt = yes +[homes] + path = /storage/%S + comment = %S's Home Directory + valid users = %S + browseable = no writable = yes read only = no - force user = root - force group = root + create mask = 0700 + directory mask = 0700