Skip to content

Instantly share code, notes, and snippets.

@wenzhixin
Created December 11, 2014 09:38
Show Gist options
  • Save wenzhixin/37d02e723b06f502e0c1 to your computer and use it in GitHub Desktop.
Save wenzhixin/37d02e723b06f502e0c1 to your computer and use it in GitHub Desktop.
/usr/local/bin/validate_share
#!/bin/bash
DATA_DIR=/home/share/sdk*
case "$SSH_ORIGINAL_COMMAND" in
rsync\ --server*)
TARGET=`echo "$SSH_ORIGINAL_COMMAND" | awk '{ print $NF }'`
if [[ "$TARGET" == $DATA_DIR ]]; then
$SSH_ORIGINAL_COMMAND
else
echo "Rejected"
fi
;;
*)
echo "Rejected"
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment