-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
65 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
FROM alpine:3.12.12 | ||
|
||
RUN apk --no-cache --no-progress upgrade && \ | ||
apk --no-cache --no-progress add bash tini && \ | ||
# SMBv1 protocols were deprecated in 4.13 -> https://www.samba.org/samba/history/samba-4.13.0.html | ||
apk --no-cache --no-progress add samba=4.12.15-r0 --repository=http://dl-cdn.alpinelinux.org/alpine/v3.12/main && \ | ||
file="/etc/samba/smb.conf" && \ | ||
sed -i 's|^;* *\(log file = \).*| \1/dev/stdout|' $file && \ | ||
sed -i '/Share Definitions/,$d' $file && \ | ||
echo ' ntlm auth = yes' >>$file && \ | ||
echo ' min protocol = LANMAN1' >>$file | ||
|
||
EXPOSE 137/udp 138/udp 139 445 | ||
|
||
COPY ./setup.sh /etc/setup.sh | ||
RUN chmod +x /etc/setup.sh | ||
ENTRYPOINT ["/sbin/tini", "--", "/etc/setup.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,9 @@ | ||
# docker-smb1 | ||
A docker container supporting "scan to share" for older scanners | ||
# Samba container with SMB1 suppport | ||
|
||
Some devices like my old printer/scanner (Canon MB5150) only support deprecated protocols to scan to. | ||
This container sets up a network share that it can access. | ||
|
||
## Install | ||
1. Clone repo | ||
2. Adjust username, password, share name and the local path on your system | ||
3. Run `docker compose up -d` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
services: | ||
smb1: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
container_name: smb-for-scanning | ||
environment: | ||
SMB_USERNAME: example_username | ||
SMB_PASSWORD: example_password | ||
SHARE_NAME: example_sharename | ||
ports: | ||
- "445:445/tcp" | ||
volumes: | ||
- /path/to/local/directory:/share |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env bash | ||
set -o nounset | ||
file="/etc/samba/smb.conf" | ||
|
||
adduser -D -H "$SMB_USERNAME"&& echo User "$SMB_USERNAME" was added to the system | ||
echo -e "$SMB_PASSWORD\n$SMB_PASSWORD" | smbpasswd -s -a "$SMB_USERNAME" | ||
smbpasswd -e "$SMB_USERNAME" > /dev/null | ||
|
||
if [ ! -d /share ] ; then | ||
mkdir /share | ||
fi | ||
chgrp "$SMB_USERNAME" /share | ||
chown -R "$SMB_USERNAME" /share | ||
|
||
echo '' >>$file && \ | ||
echo " [$SHARE_NAME]" >>$file && \ | ||
echo ' path = /share' >>$file && \ | ||
echo ' browsable = yes' >>$file && \ | ||
echo ' read only = no' >>$file && \ | ||
echo ' guest ok = no' >>$file && \ | ||
echo ' veto files = /.apdisk/.DS_Store/.TemporaryItems/.Trashes/desktop.ini/ehthumbs.db/Network Trash Folder/Temporary Items/Thumbs.db/' >>$file && \ | ||
echo ' delete veto files = yes' >>$file && \ | ||
echo " valid users = $SMB_USERNAME" >>$file | ||
|
||
smbd -FS --no-process-group && sleep infinity |