Looking waaay back to the blog post about setting up NFS for filesharing with Windows clients, I find it necessary to apologize for misleading my two faithful readers. I'm sorry!

In the beginning, it seemed easy to share files over NFS and it worked really well - until I noticed the craziness with international characters! I'm Norwegian, and use Norwegian characters a lot in my filenames. It seems that the exchange of bits and bytes between Linux and Windows over NFS hasn't quite yet overcome the problems with special characters and incompatible character sets from the past century. In comes SMB!

Long story short; I shut down my NFS-server and went all in on SMB instead. My life took a turn for the good!

This is my Docker-compose file:

  samba:
    image: dperson/samba
    container_name: samba
    restart: unless-stopped
    stdin_open: true
    tty: true
    environment:
      TZ: ${DOCKER_TZ}
      NMBD: "false"
      USERID: "1000"
      GROUPID: "1000"
      SHARE: "familyphotos;/mnt/familyphotos;yes;no;yes;all;'none';'none';'Awesome photos'"
      RECYCLE: ""
    ports:
    #  - "137:137/udp" # required only to advertise shares (NMBD)
    #  - "138:138/udp" # required only to advertise shares (NMBD)
      - "139:139/tcp" # default smb port
      - "445:445/tcp" # default smb port
    read_only: false
    tmpfs:
      - /tmp
    volumes:
      - /local/path/to/my/photos:/mnt/familyphotos

This creates a container. The container shares a folder and files owned by uid 1000 with gid 1000 (my local user) from my Linux server via the SMB protocol. Whenever someone mounts the share I've called "familyphotos" (from Windows, mount a network drive with \server-ip\familyphotos), they can read and write files as if they were me.

For my use case, this is perfect, but it creates some security conserns! The main consern is what clients to trust, so I authorize client access in my firewall and filter clients based on IP/MAC addresses. Ultimately I select specific clients (computers) that I trust to access the SMB-share.

On the Windows side, I didn't have to do anything but mounting the network drive. Super easy!

Previous Post