afa74d4557
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 <patrick@perlbach24.de>
66 lines
2.1 KiB
Bash
Executable File
66 lines
2.1 KiB
Bash
Executable File
#!/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 <section> <key> <value>"
|