Finalizing backup on CIFS share fails

CMK version: 2.1.0p9 Enterprise
OS version: Debian 11.4.0

I am trying to configure a daily backup to a remote CIFS share. The backup itself is running correctly, the site.tar.gz seems to be complete. But the last step of the backup fails, namely renaming the backup folder from “Check_MK-Hostname-sitename-destination-incomplete” to “Check_MK-Hostname-sitename-destination-complete”.

The following error is displayed in the backup log:

2022-08-04 09:19:07 --- Starting backup (Check_MK-Hostname-sitename-destination to destination) ---
2022-08-04 09:24:23 Verifying backup consistency
An exception occured:
Traceback (most recent call last):
  File "/omd/sites/sitename/bin/mkbackup", line 687, in mode_backup
    do_backup(opts)
  File "/omd/sites/sitename/bin/mkbackup", line 719, in do_backup
    complete_backup()
  File "/omd/sites/sitename/bin/mkbackup", line 1404, in complete_backup
    os.rename(job_backup_path_during_backup(), job_backup_path_complete())
PermissionError: [Errno 13] Permission denied: '/mnt/destination/Check_MK-Hostname-sitename-destination-incomplete' -> '/mnt/destination/Check_MK-Hostname-sitename-destination-complete'

In Debian the cifs-utils were installed. The credentials were stored in a .smbcredentials-file. A corresponding fstab-entry was created:

//destination/external_backup /mnt/local_folder cifs vers=3.0,uid=999,gid=1001,credentials=/home/administrator/.smbcredentials,noauto,x-systemd.automount

/mnt/local_folder was created manually. Owner is the site-user, the user rights are 755.

When logging in as site user with ssh the folder “incomplete” can be renamed to “complete” without any problems.

The problem is always reproducable. On the destination (Windows) system no other users are accessing the folder at the time of the problem. Does somebody know what I am missing?

Best regards,
UT2019

I changed file_mode and dir_mode to 0777 for testing in /etc/fstab for the mount point. I changed the group to omd, but both does not change anything.

The strange thing is that when doing “su - siteuser” and then a rename-action with “mv”, everything works as it should.

When changing the backup target to a local directory for testing, the backup works. So it probably has something to do with the remote cifs access, but I don’t know what I am doing wrong.

Best regards,
UT2019