Each time I set up my linux box (usually Debian based but this will work for most others I suspect) as a Time Machine destination, I have to search for the correct way to set up Samba and many of the hits are the older way to do it, using avahi and netatalk, before Samba support for Apple was implemented. It's now very simple. This was on Ubuntu 20.04 and Samba version 4.13.
sudo apt install samba
Add a new Samba user which will also ask for a password to be set, it should be an existing user on the system.
sudo smbpasswd -a $USER
Then edit /etc/samba/smb/conf and add the following to the [global] and [share] sections.
[global]
min protocol = SMB2
ea support = yes
vfs objects = fruit streams_xattr
fruit:metadata = stream
fruit:model = MacSamba
fruit:posix_rename = yes
fruit:veto_appledouble = no
fruit:posix_rename = yes
fruit:zero_file_id = yes
fruit:wipe_intentionally_left_blank_rfork = yes
fruit:delete_empty_adfiles = yes
[TimeMachine]
comment = TimeMachine
path = /home/stuart/timemachine
valid users = stuart
browseable = yes
writeable = yes
create mask = 0600
directory mask = 0700
spotlight = yes
vfs objects = catia fruit streams_xattr
fruit:aapl = yes
fruit:time machine = yes
Restart Samba.
sudo systemctl restart smbd.service
Then link Time Machine to the new share from Time Machine Preferences using the user and password defined earlier and everything should work as expected.