From 523a3dfbf6635c7495d62fbad3f419327029df15 Mon Sep 17 00:00:00 2001 From: Patrick Date: Wed, 22 Apr 2026 01:09:24 +0200 Subject: [PATCH] Add Samba registry setup script for initial configuration Script initializes Samba to use registry-based configuration: - Creates minimal smb.conf with 'include = registry' - Imports ZMB-optimized global settings into registry - Configures shadow copy, ZFS integration, macOS support - Restarts Samba services Run on new systems with: sudo bash deploy/setup-samba-registry.sh Co-Authored-By: Patrick --- deploy/setup-samba-registry.sh | 65 ++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100755 deploy/setup-samba-registry.sh diff --git a/deploy/setup-samba-registry.sh b/deploy/setup-samba-registry.sh new file mode 100755 index 0000000..fec169e --- /dev/null +++ b/deploy/setup-samba-registry.sh @@ -0,0 +1,65 @@ +#!/bin/bash +# Setup Samba registry-based configuration for ZMB Webui +# This script initializes Samba to use registry instead of smb.conf + +set -e + +echo "Setting up Samba Registry Configuration..." + +# 1. Create minimal smb.conf with registry include +echo "[global] + include = registry" | sudo tee /etc/samba/smb.conf > /dev/null + +# 2. Create import template with ZMB-optimized settings +cat << 'EOF' | sudo tee /etc/samba/zmb-webui.conf > /dev/null +[global] + workgroup = WORKGROUP + log file = /var/log/samba/log.%m + max log size = 1000 + logging = file + panic action = /usr/share/samba/panic-action %d + log level = 3 + server role = standalone server + obey pam restrictions = yes + unix password sync = yes + passwd program = /usr/bin/passwd %u + passwd chat = *Enter\snew\s*\password:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* . + pam password change = yes + map to guest = bad user + vfs objects = shadow_copy2 acl_xattr catia fruit streams_xattr + map acl inherit = yes + acl_xattr:ignore system acls = yes + shadow: snapdir = .zfs/snapshot + shadow: sort = desc + shadow: format = -%Y-%m-%d-%H%M + shadow: snapprefix = ^zfs-auto-snap_\(frequent\)\{0,1\}\(hourly\)\{0,1\}\(daily\)\{0,1\}\(weekly\)\{0,1\}\(monthly\)\{0,1\} + shadow: delimiter = -20 + fruit:encoding = native + fruit:metadata = stream + fruit:zero_file_id = yes + fruit:nfs_aces = no +EOF + +# 3. Import configuration into registry +echo "Importing configuration into Samba registry..." +sudo net conf import /etc/samba/zmb-webui.conf + +# 4. Verify import +echo "" +echo "Current Samba Registry Configuration:" +sudo net conf list | head -20 + +# 5. Restart Samba +echo "" +echo "Restarting Samba..." +sudo systemctl restart smbd +sudo systemctl restart nmbd + +echo "" +echo "✅ Samba Registry Setup Complete!" +echo "" +echo "Configuration details:" +echo " - smb.conf: /etc/samba/smb.conf (minimal, includes registry)" +echo " - Registry Template: /etc/samba/zmb-webui.conf" +echo " - Read Registry: sudo net conf list" +echo " - Edit Registry: sudo net conf setparm
"