Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge dev into master #24

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
25 changes: 25 additions & 0 deletions readme.md → README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,31 @@
</div></h1>

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 🐳

Expand Down
2 changes: 1 addition & 1 deletion samba.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 9 additions & 7 deletions smb.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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