I am working on a backup strategy for my servers with rsync. I followed this tutorial and to restrict the use of the SSH key, I make of this validate-rsync.sh
script that I can also run without problems:
#!/bin/sh
case "$SSH_ORIGINAL_COMMAND" in
*\&*)
echo "Rejected"
;;
*\(*)
echo "Rejected"
;;
*\{*)
echo "Rejected"
;;
*\;*)
echo "Rejected"
;;
*\<*)
echo "Rejected"
;;
*\>*)
echo "Rejected"
;;
*\`*)
echo "Rejected"
;;
*\|*)
echo "Rejected"
;;
rsync\ --server*)
$SSH_ORIGINAL_COMMAND
;;
*)
echo "Rejected"
;;
esac
The beginning of the authorized_keys
file looks like this:
command="/home/$USERNAME/validate-rsync.sh" ssh-rsa....
As far as I understand, I should not be able to remotely connect via SSH (from the server where the backup lies) and then e.g. execute mkdir xx
. But somehow, I can still do it. What could be the problem?
I am grateful for any help.