This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| fuss:samba [2018/02/11 09:48] – [Enable Synchronization between Shadow and Samba Passwords] office | fuss:samba [2025/10/21 23:26] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Faster Speed without Risks ====== | ||
| - | |||
| - | Add to ''/ | ||
| - | |||
| - | < | ||
| - | [global] | ||
| - | socket options=SO_RCVBUF=131072 SO_SNDBUF=131072 TCP_NODELAY IPTOS_LOWDELAY | ||
| - | use sendfile = true | ||
| - | max xmit = 65535 | ||
| - | max connections = 65535 | ||
| - | max open files = 65535 | ||
| - | min receivefile size = 16384 | ||
| - | aio read size = 16384 | ||
| - | aio write size = 16384 | ||
| - | read raw = yes | ||
| - | write raw = yes | ||
| - | getwd cache = yes | ||
| - | dead time = 15 | ||
| - | kernel oplocks = yes | ||
| - | </ | ||
| - | |||
| ====== Force User and Group ====== | ====== Force User and Group ====== | ||
| Line 151: | Line 130: | ||
| pam password change = yes | pam password change = yes | ||
| </ | </ | ||
| + | |||
| + | ====== Enable Volume Shadow Copies with ZFS ====== | ||
| + | |||
| + | If the underlying filesystem supports shadow copies then Samba can be made to utilize shadow copies. On Debian, first install '' | ||
| + | <code bash> | ||
| + | aptitude install zfs-auto-snapshot | ||
| + | </ | ||
| + | |||
| + | and then enable the '' | ||
| + | < | ||
| + | [global] | ||
| + | ... | ||
| + | vfs_objects = shadow_copy2 | ||
| + | shadow: snapdir = .zfs/ | ||
| + | shadow: sort = desc | ||
| + | shadow: format = zfs-auto-snap_%S-%Y-%m-%d-%H%M | ||
| + | shadow: | ||
| + | </ | ||
| + | |||
| + | ====== Performance with ZFS ====== | ||
| + | |||
| + | At the time of writing, ZFS does not have sendfile support, so make sure to disable it for a performance boost and particularly if timeouts are to be observed: | ||
| + | < | ||
| + | use sendfile = no | ||
| + | </ | ||
| + | |||
| + | ====== Enable Web Service Discovery (WSDD) Instead of NetBIOS ====== | ||
| + | |||
| + | Web Service Discovery (WSDD) is the next generation host discovery after NetBIOS has been deprecated in Windows 10 version 1511. WSDD needs a script to be ran independently of Samba. Projects such as [[https:// | ||
| + | |||
| + | ====== Samba Variables not Working ====== | ||
| + | |||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | ====== Enable Filesystem Cache ====== | ||
| + | |||
| + | Recent versions of Samba have the ability to cache files locally via the '' | ||
| + | |||
| + | <code bash> | ||
| + | aptitude install cachefilesd | ||
| + | </ | ||
| + | |||
| + | and then enable the daemon by editing ''/ | ||
| + | < | ||
| + | RUN=yes | ||
| + | </ | ||
| + | |||
| + | Finally, when mounting the Samba share from a client, pass the '' | ||
| + | < | ||
| + | // | ||
| + | </ | ||
| + | |||
| + | The cache can then be monitored by reading the directory ''/ | ||
| + | |||
| + | ====== Periodically Cleaning up the Recycle Bin ====== | ||
| + | |||
| + | By enabling the '' | ||
| + | |||
| + | The problem is that the '' | ||
| + | |||
| + | For example, the following script: | ||
| + | <code bash> | ||
| + | # | ||
| + | ########################################################################### | ||
| + | ## Copyright (C) Wizardry and Steamworks 2024 - License: MIT ## | ||
| + | ########################################################################### | ||
| + | |||
| + | ########################################################################### | ||
| + | ## CONFIGURATION | ||
| + | ########################################################################### | ||
| + | |||
| + | # Should be set to the number of days that files will be kept. Any file | ||
| + | # found to be older than this amount of days will be deleted. | ||
| + | DELETE_OLDER_THAN_DAYS=5 | ||
| + | |||
| + | # Samba mount paths with " | ||
| + | MOUNT_PATHS=( /mnt/archie /mnt/docker ) | ||
| + | |||
| + | ########################################################################### | ||
| + | ## INTERNALS | ||
| + | ########################################################################### | ||
| + | |||
| + | # Acquire a lock. | ||
| + | LOCK_FILE='/ | ||
| + | if mkdir $LOCK_FILE 2>&1 >/ | ||
| + | trap '{ rm -rf $LOCK_FILE; }' KILL QUIT TERM EXIT INT HUP | ||
| + | else | ||
| + | exit 0 | ||
| + | fi | ||
| + | |||
| + | for MOUNT_PATH in " | ||
| + | if [ ! -d " | ||
| + | echo "Mount path \" | ||
| + | continue | ||
| + | fi | ||
| + | |||
| + | find " | ||
| + | -depth \ | ||
| + | -type d -o -type f \ | ||
| + | -ctime +${DELETE_OLDER_THAN_DAYS} \ | ||
| + | -exec rm -rf ' | ||
| + | done | ||
| + | |||
| + | </ | ||
| + | |||
| + | can be dropped inside ''/ | ||
| + | |||
For the contact, copyright, license, warranty and privacy terms for the usage of this website please see the contact, license, privacy, copyright.