A key for an automated job does not need a shell. In authorized_keys you can tie it to one command, and the server runs that command whatever the client asks for.
Put the options in front of the key, on the same line:
restrict,command="/usr/local/bin/backup.sh" ssh-ed25519 AAAAC3Nza... backup@example
command= forces the command. restrict switches off port, agent and X11 forwarding, PTY allocation and ~/.ssh/rc, and the man page says future restrictions get added to it too. I’d always pair the two, because the man page also points out that a forced command alone still allows forwarding unless you block it.
The command the client asked for is not lost. sshd puts it in SSH_ORIGINAL_COMMAND, so a small wrapper script can allow a few known commands and refuse the rest:
#!/bin/sh
case "$SSH_ORIGINAL_COMMAND" in
"rsync --server"*) exec $SSH_ORIGINAL_COMMAND ;;
*) echo "not allowed" >&2; exit 1 ;;
esac
That wrapper is now part of your attack surface. Keep it short, never pass the variable through eval, and test what happens with odd input before you trust it.
Further reading: sshd man page, AUTHORIZED_KEYS FILE FORMAT