title: how to safely receive files from end-users via rsync
body: <p>I'd like to allow users of my web application to upload the contents of a directory via rsync. These are just users who've signed up online, so I don't want to create permanent unix accounts for them, and I want to ensure that whatever files they upload are stored on my server only under a directory specific to their account. Ideally, the flow would be something like this:</p>
  
  <ol>
  <li>user says "I'd like to update my files with rsync" via authenticated web UI</li>
  <li>server says "OK, please run: rsync /path/to/yourfiles uploaduser123abc@myserver:/"</li>
  <li>client runs that, updating whatever files have changed onto the server
  <ul>
  <li>upload location is chrooted or something -- we want to ensure client only writes to files under a designated directory on the server</li>
  <li>ideally, client doesn't need to enter a password - the 123abc in the username is enough of a secret token to keep this one rsync transaction secure, and after the transaction this token is destroyed - no more rsyncs until a new step 1 occurs.</li>
  </ul></li>
  <li>server has an updated set of user's files.</li>
  </ol>
  
  <p>If you've used Google AppEngine, the desired behavior is similar to its "update" command -- it sends only the changed files to appengine for hosting.</p>
  
  <p>What's the best approach for implementing something like this? Would it be to create one-off users and then run an rsync daemon in a chroot jail under those accounts? Are there any libraries (preferably Python) or scripts that might do something like this?</p>