Skip to content

Instantly share code, notes, and snippets.

@thoughtsunificator
Last active January 24, 2025 19:02
Show Gist options
  • Save thoughtsunificator/6ad8499faaee30900b38025f6ad2d1c3 to your computer and use it in GitHub Desktop.
Save thoughtsunificator/6ad8499faaee30900b38025f6ad2d1c3 to your computer and use it in GitHub Desktop.

Revisions

  1. thoughtsunificator revised this gist Jan 24, 2025. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions smb.conf
    Original file line number Diff line number Diff line change
    @@ -43,8 +43,7 @@ server role = standalone server
    # With user-level security a client must first "log-on" with a valid username and password (which can be mapped using the username map parameter).
    security = user

    # log level = 1
    log level = 3 passdb:5 auth:5
    log level = 1

    dns proxy = no

  2. thoughtsunificator revised this gist Jan 24, 2025. 1 changed file with 0 additions and 20 deletions.
    20 changes: 0 additions & 20 deletions smb.conf
    Original file line number Diff line number Diff line change
    @@ -46,26 +46,6 @@ security = user
    # log level = 1
    log level = 3 passdb:5 auth:5

    # Raw read and write:
    # These are important performance configuration options; they enable Samba to use large reads and writes to the network, of up to 64KB in a single SMB request. They also require the largest SMB packet structures, SMBreadraw and SMBwriteraw, from which the options take their names. In the past, some clients failed if you tried to use read raw. No clients suffer from this problem now. Read and write raw default to yes, and should be left on unless you find you have one of the ancient buggy clients.
    read raw = yes
    write raw = yes

    # dead time:
    # Number of minutes of inactivity before a connection should be terminated.
    dead time = 15

    # getwd cache:
    # This option caches the path to the current directory avoiding directory listing waits.
    getwd cache = yes

    # this tells Samba to use a separate log file for each machine
    # that connects
    log file = /var/log/samba/%m.log

    # Put a capping on the size of the log files (in Kb).
    max log size = 50

    dns proxy = no

    [media]
  3. thoughtsunificator revised this gist Jan 24, 2025. 1 changed file with 0 additions and 4 deletions.
    4 changes: 0 additions & 4 deletions smb.conf
    Original file line number Diff line number Diff line change
    @@ -51,10 +51,6 @@ log level = 3 passdb:5 auth:5
    read raw = yes
    write raw = yes

    # max xmit:
    # In Samba, the option that is directly related with the MTU and window size is max xmit. This option sets the largest block of data Samba will try to write at any one time
    max xmit = 65535

    # dead time:
    # Number of minutes of inactivity before a connection should be terminated.
    dead time = 15
  4. thoughtsunificator revised this gist Jan 24, 2025. 1 changed file with 0 additions and 12 deletions.
    12 changes: 0 additions & 12 deletions smb.conf
    Original file line number Diff line number Diff line change
    @@ -29,9 +29,6 @@ workgroup = MIDEARTH
    # server string is the equivalent of the NT Description field
    server string = myserver

    # The vfs_streams_xattr enables storing of NTFS alternate data streams in the file system.
    vfs objects = streams_xattr

    # Server role. Defines in which mode Samba will operate. Possible
    # values are "standalone server", "member server", "classic primary
    # domain controller", "classic backup domain controller", "active
    @@ -46,18 +43,9 @@ server role = standalone server
    # With user-level security a client must first "log-on" with a valid username and password (which can be mapped using the username map parameter).
    security = user

    # experimental
    # whether all printers in the printcap will be loaded for browsing by default
    load printers = no

    # log level = 1
    log level = 3 passdb:5 auth:5

    # Tells the server to send as many packets as necessary to keep delay low. This will account for a 30 percent speedup by itself. In Samba 2.0 socket options = TCP_NODELAY became the default value.
    # SO_SNDBUF and SO_RCVBUF:
    # The send and receive buffers can often be the reset to a value higher than that of the operating system. This yields a marginal increase of speed until it reaches a point of diminishing returns. For a modern OpenBSD box serving shares to Windows xp/Vista or Linux machines a SO_SNDBUF and SO_RCVBUF of 65536 increased throughput by as much as 20% by itself.
    socket options = TCP_NODELAY SO_RCVBUF=65536 SO_SNDBUF=65536

    # Raw read and write:
    # These are important performance configuration options; they enable Samba to use large reads and writes to the network, of up to 64KB in a single SMB request. They also require the largest SMB packet structures, SMBreadraw and SMBwriteraw, from which the options take their names. In the past, some clients failed if you tried to use read raw. No clients suffer from this problem now. Read and write raw default to yes, and should be left on unless you find you have one of the ancient buggy clients.
    read raw = yes
  5. thoughtsunificator revised this gist Jan 24, 2025. 1 changed file with 93 additions and 0 deletions.
    93 changes: 93 additions & 0 deletions smb.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,93 @@
    # samba-server-4.20.6-r1
    # This is the main Samba configuration file. You should read the
    # smb.conf(5) manual page in order to understand the options listed
    # here. Samba has a huge number of configurable options (perhaps too
    # many!) most of which are not shown in this example
    #
    # For a step to step guide on installing, configuring and using samba,
    # read the Samba-HOWTO-Collection. This may be obtained from:
    # http://www.samba.org/samba/docs/Samba-HOWTO-Collection.pdf
    #
    # Many working examples of smb.conf files can be found in the
    # Samba-Guide which is generated daily and can be downloaded from:
    # http://www.samba.org/samba/docs/Samba-Guide.pdf
    #
    # Any line which starts with a ; (semi-colon) or a # (hash)
    # is a comment and is ignored. In this example we will use a #
    # for commentry and a ; for parts of the config file that you
    # may wish to enable
    #
    # NOTE: Whenever you modify this file you should run the command "testparm"
    # to check that you have not made any basic syntactic errors.
    #
    #======================= Global Settings =====================================
    [global]

    # workgroup = NT-Domain-Name or Workgroup-Name, eg: MIDEARTH
    workgroup = MIDEARTH

    # server string is the equivalent of the NT Description field
    server string = myserver

    # The vfs_streams_xattr enables storing of NTFS alternate data streams in the file system.
    vfs objects = streams_xattr

    # Server role. Defines in which mode Samba will operate. Possible
    # values are "standalone server", "member server", "classic primary
    # domain controller", "classic backup domain controller", "active
    # directory domain controller".
    #
    # Most people will want "standalone server" or "member server".
    # Running as "active directory domain controller" will require first
    # running "samba-tool domain provision" to wipe databases and create a
    # new domain.
    server role = standalone server

    # With user-level security a client must first "log-on" with a valid username and password (which can be mapped using the username map parameter).
    security = user

    # experimental
    # whether all printers in the printcap will be loaded for browsing by default
    load printers = no

    # log level = 1
    log level = 3 passdb:5 auth:5

    # Tells the server to send as many packets as necessary to keep delay low. This will account for a 30 percent speedup by itself. In Samba 2.0 socket options = TCP_NODELAY became the default value.
    # SO_SNDBUF and SO_RCVBUF:
    # The send and receive buffers can often be the reset to a value higher than that of the operating system. This yields a marginal increase of speed until it reaches a point of diminishing returns. For a modern OpenBSD box serving shares to Windows xp/Vista or Linux machines a SO_SNDBUF and SO_RCVBUF of 65536 increased throughput by as much as 20% by itself.
    socket options = TCP_NODELAY SO_RCVBUF=65536 SO_SNDBUF=65536

    # Raw read and write:
    # These are important performance configuration options; they enable Samba to use large reads and writes to the network, of up to 64KB in a single SMB request. They also require the largest SMB packet structures, SMBreadraw and SMBwriteraw, from which the options take their names. In the past, some clients failed if you tried to use read raw. No clients suffer from this problem now. Read and write raw default to yes, and should be left on unless you find you have one of the ancient buggy clients.
    read raw = yes
    write raw = yes

    # max xmit:
    # In Samba, the option that is directly related with the MTU and window size is max xmit. This option sets the largest block of data Samba will try to write at any one time
    max xmit = 65535

    # dead time:
    # Number of minutes of inactivity before a connection should be terminated.
    dead time = 15

    # getwd cache:
    # This option caches the path to the current directory avoiding directory listing waits.
    getwd cache = yes

    # this tells Samba to use a separate log file for each machine
    # that connects
    log file = /var/log/samba/%m.log

    # Put a capping on the size of the log files (in Kb).
    max log size = 50

    dns proxy = no

    [media]
    path = /mount
    valid users = cloud
    force user = cloud
    force group = cloud
    writable = yes
    printable = no
  6. thoughtsunificator revised this gist Jan 10, 2025. 1 changed file with 0 additions and 3 deletions.
    3 changes: 0 additions & 3 deletions docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -11,6 +11,3 @@ services:
    - ./smb.conf:/etc/samba/smb.conf
    ports:
    - 445:445
    environment:
    - TZ=Europe/Paris

  7. thoughtsunificator revised this gist Jan 7, 2025. 1 changed file with 6 additions and 6 deletions.
    12 changes: 6 additions & 6 deletions Dockerfile
    Original file line number Diff line number Diff line change
    @@ -1,14 +1,14 @@
    # 3.21.1
    FROM alpine@sha256:b97e2a89d0b9e4011bb88c02ddf01c544b8c781acf1f4d559e7c8f12f1047ac3
    ':
    ARG SAMBA_USER=cloud eos
    ARG SAMBA_PASSWORD="r7YOFnt/m49lROpYiGSAqJhkJAgoymV0F8Rnq1aZOCI=" eos

    ARG SAMBA_USER=cloud
    ARG SAMBA_PASSWORD="r7YOFnt/m49lROpYiGSAqJhkJAgoymV0F8Rnq1aZOCI="

    RUN apk add --update \
    samba-common-tools=4.20.6-r1 \
    samba-client=4.20.6-r1 \ ide
    samba-server=4.20.6-r1 \ _Ra
    && rm -rf /var/cache/apk/* rr/
    samba-client=4.20.6-r1 \
    samba-server=4.20.6-r1 \
    && rm -rf /var/cache/apk/*

    RUN adduser -D -g $SAMBA_USER $SAMBA_USER \
    && echo -e "$SAMBA_PASSWORD\n$SAMBA_PASSWORD" | smbpasswd -a $SAMBA_USER
  8. thoughtsunificator revised this gist Jan 7, 2025. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion Dockerfile
    Original file line number Diff line number Diff line change
    @@ -16,4 +16,3 @@ RUN adduser -D -g $SAMBA_USER $SAMBA_USER \
    EXPOSE 445/tcp
    ENTRYPOINT ["smbd", "--foreground", "--debug-stdout", "--no-process-group"]
    CMD []
  9. thoughtsunificator created this gist Jan 7, 2025.
    19 changes: 19 additions & 0 deletions Dockerfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    # 3.21.1
    FROM alpine@sha256:b97e2a89d0b9e4011bb88c02ddf01c544b8c781acf1f4d559e7c8f12f1047ac3
    ':
    ARG SAMBA_USER=cloud eos
    ARG SAMBA_PASSWORD="r7YOFnt/m49lROpYiGSAqJhkJAgoymV0F8Rnq1aZOCI=" eos
    RUN apk add --update \
    samba-common-tools=4.20.6-r1 \
    samba-client=4.20.6-r1 \ ide
    samba-server=4.20.6-r1 \ _Ra
    && rm -rf /var/cache/apk/* rr/
    RUN adduser -D -g $SAMBA_USER $SAMBA_USER \
    && echo -e "$SAMBA_PASSWORD\n$SAMBA_PASSWORD" | smbpasswd -a $SAMBA_USER
    EXPOSE 445/tcp
    ENTRYPOINT ["smbd", "--foreground", "--debug-stdout", "--no-process-group"]
    CMD []
    16 changes: 16 additions & 0 deletions docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    services:
    server:
    restart: unless-stopped
    build:
    context: .
    args:
    - SAMBA_USER=${SAMBA_USER:-cloud}
    - SAMBA_PASSWORD=${SAMBA_PASSWORD:-r7YOFnt/m49lROpYiGSAqJhkJAgoymV0F8Rnq1aZOCI=}
    volumes:
    - /mnt/windows:/mount
    - ./smb.conf:/etc/samba/smb.conf
    ports:
    - 445:445
    environment:
    - TZ=Europe/Paris