Skip to content

Commit

Permalink
Merge pull request #628 from nextcloud/enh/add-samba-image
Browse files Browse the repository at this point in the history
  • Loading branch information
skjnldsv authored Feb 11, 2024
2 parents d9a6c81 + 68eb6c4 commit 748e594
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 0 deletions.
25 changes: 25 additions & 0 deletions samba/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Inspired by https://hub.docker.com/r/silvershell/samba/
FROM debian:bookworm

ENV SMB_USER smbuser
ENV SMB_PASSWORD smbpassword

RUN apt-get update && apt-get install -y \
samba \
smbclient \
&& rm -rf /var/lib/apt/lists/*

RUN mkdir -p /opt/samba/share
RUN chmod 777 /opt/samba/share

RUN mkdir -p /opt/samba/user
RUN chmod 777 /opt/samba/user

RUN useradd -s /bin/false "$SMB_USER"
RUN (echo "$SMB_PASSWORD"; echo "$SMB_PASSWORD" ) | pdbedit -a -u "$SMB_USER"

EXPOSE 137/udp 138/udp 139 445

COPY smb.conf /etc/samba/smb.conf

CMD /usr/sbin/smbd --daemon --foreground --debug-stdout
46 changes: 46 additions & 0 deletions samba/smb.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
[global]
security = user

load printers = no
printcap name = /dev/null
printing = bsd

unix charset = UTF-8
dos charset = CP932

workgroup = WORKGROUP

server string = %h server (Samba, Ubuntu)
dns proxy = no
interfaces = eth* lo
bind interfaces only = no
log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0
panic action = /usr/share/samba/panic-action %d
server role = standalone server
passdb backend = tdbsam
obey pam restrictions = yes
unix password sync = yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
pam password change = yes
map to guest = Bad User
usershare allow guests = yes

[public]
path = /opt/samba/share
writable = yes
printable = no
public = yes
guest only = yes
create mode = 0777
directory mode = 0777

[user]
path = /opt/samba/user
writable = yes
printable = no
public = no
create mode = 0777
directory mode = 0777

0 comments on commit 748e594

Please sign in to comment.