The way I do it is I create backups locally and then copy them to my NAS over ftp(with a password), instead of samba. Hopefully, that way any ransomeware would not be able to encrypt my nas as well, as it does not have any publicly accessible folders on the network.