- Debian 10 installed
- ZFS storage is required for "Restore Previous Versions" feature
sudo apt-get install samba
- Comment out all the existing share lines
sudo nano /etc/samba/smb.conf
;[homes] ;[netlogon] ;[profiles] ;[printers] ; etc...
- Add public shares:
echo " [public] comment = Public Files browseable = yes read only = no path = /${HOSTNAME}/public guest ok = no valid users = $USER `cat users.txt` create mask = 0775 force create mode = 0775 directory mask = 0775 force directory mode = 0775 " | sudo tee -a /etc/samba/smb.conf
- Add user shares:
for user in $USER `cat users.txt`; do echo " [${user}] comment = ${user} browseable = no read only = no path = /${HOSTNAME}/${user} guest ok = no valid users = ${user} create mask = 0775 force create mode = 0775 directory mask = 0775 force directory mode = 0775 " | sudo tee -a /etc/samba/smb.conf done
- Add users to Samba
for user in $USER `cat users.txt`; do sudo smbpasswd -a ${user} done
- Restart Samba:
sudo service smbd restart
Add zfs-auto-snapshot
hook for Restore Previous Versions feature on windows clients.
Source: github.com/zfsonlinux and samba.org
- Edit Samba config:
sudo nano /etc/samba/smb.conf
- Add the following in the
[global]
section. NOT below any share definition.;# allow ZFS snapshots to show up in 'Restore Previous Versions' vfs objects = shadow_copy2 shadow: snapdir = .zfs/snapshot shadow: sort = desc shadow:snapdirseverywhere = yes shadow: format = -%Y-%m-%d-%H%M shadow: snapprefix = ^zfs-auto-snap_\(frequent\)\{0,1\}\(hourly\)\{0,1\}\(daily\)\{0,1\}\(monthly\)\{0,1\} shadow: delimiter = -20
- Restart Samba:
sudo service smbd restart
- Explore extras