When using the SSH protocol for running automated remote commands you can improve security using forced command[1] within your authorized_keys file.
[1] https://ctrlnotes.com/restrict-a-user-to-ssh-forced-command/...
[1] https://ctrlnotes.com/restrict-a-user-to-ssh-forced-command/...
from="192.168.1.0/24"