how to automate proxmox backup client command

Thanks @fabian for the quick reply. Yes, actually - Windows did touch that file. I wrote out the commands in notepad++ on Windows and copied the file over via sftp.

I trashed the Windows file, created a new one with nano, and it worked! I had to add "bash" before the path to the script in crontab or it wouldn't work, but so far, I'm a few tests deep and firing off backups like a mad-man!
Code:
21 * * * * bash /root/pbs.sh

I had no idea there was some sort of Windows germ following that file around. I just assumed text was text, but I guess it could smell the Windows stink on it and said no thanks. I had tried playing with permissions, making it executable, etc. on the pve host, but none of that worked. Thanks for jumping in and saving me more hours of troubleshooting.
 
Is there a way to execute the Proxmox Backup Client as another user or with an API token?

root@ubuntu:~# cat /root/pbs.sh
#!/bin/bash

PBS_PASSWORD='SECRET'
PBS_FINGERPRINT='SECRET2'
export PBS_PASSWORD
export PBS_FINGERPRINT

proxmox-backup-client backup root.pxar:/ --repository ubntbak@pbs@192.168.10.9:pbs-ssd
root@ubuntu:~#


root@ubuntu:~# sudo /root/pbs.sh
Starting backup: host/ubuntu/2025-09-02T21:47:47Z
Client name: ubuntu
Starting backup protocol: Tue Sep 2 21:47:47 2025
storing login ticket failed: $XDG_RUNTIME_DIR must be set
Error: backup owner check failed (ubntbak@pbs != root@pam)
root@ubuntu:~#
 
the error is from the server - the group is currently owned by the user "root@pam" on the PBS side, if you want to now create backups using a different user, you have to change owner first.