-
Notifications
You must be signed in to change notification settings - Fork 0
RemoteServerSambaConfig
Luca Finzi Contini edited this page Oct 21, 2024
·
8 revisions
On the remote server we want these features
- Normal Samba folders of our backed up data;
- The Samba backup folders shall be READ ONLY: we do not want to modify our backups, otherwise... they would not be backups anymore :)
- We want to be able to see all our snapshots through Windows' Previous versions, as this screenshot:

Here is the configuration file /etc/samba/smb.conf :
[global]
workgroup = WORKGROUP
netbios name = BACKUP
wins support = 1
log level = 1
max log size = 1000
read only = no
server string = %h, the COOLEST ZFS backup server ever
security = USER
smb passwd file = /etc/samba/smbpasswd
encrypt passwords = YES
max protocol = SMB3
min protocol = SMB3
[DocumentsBackup]
comment = ZFS mirrored disks vdev Documents folder backup
path=/mnt/storage/DocumentsBackup
valid users = buser
read only = yes
vfs objects = shadow_copy2
shadow:localtime = yes
shadow:format = %Y.%m.%d-%H.%M.%S
shadow:sort = desc
shadow:basedir = /mnt/storage/DocumentsBackup
shadow:snapdir = /mnt/storage/DocumentsBackup/.zfs/snapshot
Please note that in this file the stanza is named after the destination filesystem DocumentsBackup.
The real magic starts with the vfs object line, which uses this shadow_copy2 plugin, and the following lines describe where to find the snapshots that will be exposed in the Windows Previous Versions window.
Then we enable the buser user as a Samba user with smbpasswd:
buser@backup:/etc/samba$ sudo smbpasswd -a buser
lpcfg_do_global_parameter: WARNING: The "encrypt passwords" option is deprecated
New SMB password:
Retype new SMB password:
Added user buser.
buser@backup:/etc/samba$
buser@backup:/etc/samba$ sudo service smbd restart
buser@backup:/etc/samba$ sudo service nmbd restart
buser@backup:/etc/samba$
Now let's check on Windows:
- open Windows Explorer and go to
\\backup - Windows will ask you for username and password; type
buseras user and the password you just inserted in the previoussmbpasswdcommand; - The fresh
DocumentsBackupshare will be displayed. Right-Click on it and selectPrevious Versions, and, lo and behold:
- Try to open a file from the Samba backup data:
- The backup data is set to read only: verify this by trying to delete a file from Windows. You will obtain a 'permission' problem like this:
That's the main workings of the system.
I believe it is pretty awesome.
What do you think about it?
Enough bragging, let's continue with normal backup operations.
ZFS Backup, (c) 2024 Luca Finzi Contini - Use it at your own risk but enjoy doing so :)