I know how to configure a per-site entry for ssh, but is there any kind of a client configuration for rsync that allows per-site configuration options and aliases or similar shortcuts like the .ssh/config?

I'm curious because I have a minimal ssh server installed on my android phone and I also have a minimal rsync tool on it as well. I'm getting tired of having to root login onto the phone and sym-link both tools to standard places the android OS looks for executables as the ssh server is bare bones and has a typical *bear multi-link binary for the basic unix commands (that does not include rsync)

I end up having to include --rsync-path=/path/to/rsync/android/files/rsync every time I want to do any rsyncing of the files on my phone, but this path is always the same. I've gotten around it in the meantime with a glob approach in a shell script wrapper, but this sometimes limits the customization I can do with the rsync call.

I'm just wondering if there is anything similar to the .ssh/config file where I can create an alias for my phone (e.g. 'android') where specifying rsync android:/mnt/sdcard will automatically assume --rsync-path=/blah/blah/blah --no-g --no-p --no-t etc.



Check out ssh forced-commands. It's easy to use and it forces the target host to run a certain command. The gist is:

  1. Create a new key pair.
  2. Put the public key in the android user's authorized_keys file, with the following at the beginning of the line: `command="/path/to/rsync $SSH_ORIGINAL_COMMAND"
  3. Add this argument to the rsync command `-e "/path/to/ssh -i /path/to/private_key"

This will force the android to run the indicated program, the SSH_ORIGINAL_COMMAND parameter will be replaced by any other options. Google "rsync forced-command" and you'll find plenty of recipes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.