Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- cd $HOME
- # block any non-rsync commands
- echo "$SSH_ORIGINAL_COMMAND" | grep -q '^rsync --server' || exit 1
- # force all paths to reside within home directory, and filter '..' relative path shifts.
- RSYNC_COMMAND=$(echo $SSH_ORIGINAL_COMMAND | sed -r 's@ \. /(.*)$@ . ./\1@; s@\.+@.@g;')
- # add other options for efficiency
- RSYNC_COMMAND=$(echo $RSYNC_COMMAND | sed 's/--server/--server --safe-links --no-g --no-o --fuzzy --inplace -z/')
- # echo "remote command: $RSYNC_COMMAND" >&2
- exec $RSYNC_COMMAND
Advertisement
Add Comment
Please, Sign In to add comment