|
| 1 | +--- |
| 2 | +# docker-compose.yml example for https://github.com/ServerContainers/samba |
| 3 | + |
| 4 | +services: |
| 5 | + samba: |
| 6 | + # build: . |
| 7 | + # image: ghcr.io/servercontainers/samba |
| 8 | + image: servercontainers/samba:smbd-only-a3.22.1-s4.21.4-r4 |
| 9 | + restart: always |
| 10 | + # note that this network_mode makes it super easy (especially for zeroconf) but is not as safe as exposing ports directly |
| 11 | + # more about that here: https://book.hacktricks.wiki/en/linux-hardening/privilege-escalation/docker-security/docker-breakout-privilege-escalation/index.html#hostnetwork |
| 12 | + network_mode: host |
| 13 | + # uncomment to solve bug: https://github.com/ServerContainers/samba/issues/50 - wsdd2 only - not needed for samba |
| 14 | + #cap_add: |
| 15 | + # - CAP_NET_ADMIN |
| 16 | + environment: |
| 17 | + # uncomment to enable fail fast (currently only fails fast if there are conflicts/errors during user/group creation) |
| 18 | + #FAIL_FAST: 1 |
| 19 | + |
| 20 | + MODEL: 'TimeCapsule' |
| 21 | + AVAHI_NAME: StorageServer |
| 22 | + |
| 23 | + SAMBA_CONF_LOG_LEVEL: 3 |
| 24 | + |
| 25 | + # uncomment to disable optional services |
| 26 | + WSDD2_DISABLE: 1 |
| 27 | + AVAHI_DISABLE: 1 |
| 28 | + NETBIOS_DISABLE: 1 |
| 29 | + |
| 30 | + GROUP_family: 1500 |
| 31 | + |
| 32 | + ACCOUNT_alice: alipass |
| 33 | + UID_alice: 1000 |
| 34 | + GROUPS_alice: family |
| 35 | + |
| 36 | + ACCOUNT_bob: bobpass |
| 37 | + UID_bob: 1001 |
| 38 | + GROUPS_bob: family |
| 39 | + |
| 40 | + # example for hashed password (user: foo | password: bar) - generated using create-hash.sh script. |
| 41 | + ACCOUNT_foo: "foo:1000:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:86C156FC198B358CCCF6278D8BD49B6A:[U ]:LCT-61B0859A:" |
| 42 | + # example for password hashes in the list format: |
| 43 | + # - "ACCOUNT_foo=foo:1000:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:8846F7EAEE8FB117AD06BDD830B7586C:[U ]:LCT-5FE1F7DF:" |
| 44 | + UID_foo: 1002 |
| 45 | + GROUPS_foo: family |
| 46 | + |
| 47 | + SAMBA_VOLUME_CONFIG_shared_home: "[Home]; path=/shares/homes/%U; valid users = alice, bob, foo; guest ok = no; read only = no; browseable = yes" |
| 48 | + |
| 49 | +# SAMBA_VOLUME_CONFIG_aliceonly: "[Alice Share]; path=/shares/alice; valid users = alice; guest ok = no; read only = no; browseable = yes" |
| 50 | +# SAMBA_VOLUME_CONFIG_alicehidden: "[Alice Hidden Share]; path=/shares/alice-hidden; valid users = alice; guest ok = no; read only = no; browseable = no" |
| 51 | + |
| 52 | +# SAMBA_VOLUME_CONFIG_bobonly: "[Bob Share]; path=/shares/bob; valid users = bob; guest ok = no; read only = no; browseable = yes" |
| 53 | + |
| 54 | +# SAMBA_VOLUME_CONFIG_public: "[Public]; path=/shares/public; valid users = alice, bob, foo; guest ok = no; read only = no; browseable = yes; force group = family" |
| 55 | +# SAMBA_VOLUME_CONFIG_public_ro: "[Public ReadOnly]; path=/shares/public; guest ok = yes; read only = yes; browseable = yes; force group = family" |
| 56 | + |
| 57 | +# SAMBA_VOLUME_CONFIG_timemachine: "[TimeMachine]; path=/shares/timemachine/%U; valid users = alice, bob, foo; guest ok = no; read only = no; browseable = yes; fruit:time machine = yes; fruit:time machine max size = 500G" |
| 58 | + |
| 59 | +# SAMBA_VOLUME_CONFIG_guestmultilineexample: | |
| 60 | +# [Guest Share] |
| 61 | +# path = /shares/guest |
| 62 | +# guest ok = yes |
| 63 | +# browseable = yes |
| 64 | + |
| 65 | + volumes: |
| 66 | +# - /etc/avahi/services/:/external/avahi |
| 67 | + |
| 68 | + # avoid loops when mounting folders to /shares (I'd recommend explicit mapping for each share) |
| 69 | +# - ./shares/alice:/shares/alice |
| 70 | +# - ./shares/alice-hidden:/shares/alice-hidden |
| 71 | +# - ./shares/bob:/shares/bob |
| 72 | +# - ./shares/public:/shares/public |
| 73 | +# - ./shares/homes:/shares/homes |
| 74 | +# - ./shares/timemachine:/shares/timemachine |
| 75 | + - ./shares-homes:/shares/homes |
0 commit comments