App-FileSync
view release on metacpan or search on metacpan
Nothing needs naming: the client reports its host name, which is the id
`client allow` lists and the name the server keeps this client's base, its
journal entries and its conflict copies under. Pass `--id` only when the
host name is not the name you want, and allow that name on the server
instead. An id is not a login - the ssh key and the account do the
authenticating - and it does not divide the repo: every client of a repo
syncs the whole tree.
ssh runs with `BatchMode=yes`, so the client's key must already be in the
server account's `authorized_keys`, or loaded in `ssh-agent`: cron cannot
answer a password prompt.
### From Cron
```
# crontab -e, on each client
* * * * * ionice -c3 /usr/local/bin/filesync sync --repo documents --quiet >/dev/null
```
The summary line is dropped so cron does not mail on every successful run;
diagnostics still go to standard error, so a failure is mailed. Every attempt,
lib/App/FileSync.pm view on Meta::CPAN
Nothing needs naming: the client reports its host name, which is the id
C<client allow> lists and the name the server keeps this client's base, its
journal entries and its conflict copies under. Pass C<--id> only when the
host name is not the name you want, and allow that name on the server
instead. An id is not a login - the ssh key and the account do the
authenticating - and it does not divide the repo: every client of a repo
syncs the whole tree.
ssh runs with C<BatchMode=yes>, so the client's key must already be in the
server account's F<authorized_keys>, or loaded in C<ssh-agent>: cron cannot
answer a password prompt.
=head2 From cron
# crontab -e, on each client
* * * * * ionice -c3 /usr/local/bin/filesync sync --repo documents --quiet >/dev/null
The summary line is dropped so cron does not mail on every successful run;
diagnostics still go to standard error, so a failure is mailed. Every attempt,
successful or not, is also appended to F<~/.filesync/logs/documents.jsonl>, and
C<filesync log --repo documents --exit 1> lists the ones that failed.
website/html/how-it-works.html view on Meta::CPAN
<p><code>flock</code> is advisory and, on NFS, may not lock across machines at
all. Keep the server root and the client's <code>~/.filesync</code> on local
disks.</p>
<h2 id="security">Security model</h2>
<ul>
<li><strong>Authentication is ssh's.</strong> The client id is a name for
bases, journals and conflict copies, not a credential. ssh runs with
<code>BatchMode=yes</code>, so cron cannot sit at a password prompt.</li>
<li><strong>The server pins the session.</strong> sshd starts
<code>filesync-server</code> with <code>--repo</code>, <code>--client</code>
and <code>--role</code> from <code>authorized_keys</code>. An ssh server of
the form <code>-v@host</code>, or a program name starting with <code>-</code>,
is refused rather than passed to ssh as an option.</li>
<li><strong>Ids are plain.</strong> A repo or client name must match
<code>[A-Za-z0-9][A-Za-z0-9._-]*</code> and be at most 64 characters, so
<code>../x</code> cannot become a path.</li>
<li><strong>Paths are validated on the wire.</strong> No absolute paths,
drive letters, backslashes, NUL or control characters, empty or
website/html/quickstart.html view on Meta::CPAN
<code>client allow</code> lists and the name the server keeps this client's
base, its journal entries and its conflict copies under. Pass <code>--id</code>
only when the host name is not the name you want, and allow that name on the
server instead. An id is not a login — the ssh key and the account do the
authenticating — and it does not divide the repo: every client of a repo
syncs the whole tree.</p>
<div class="callout">
<p>ssh runs with <code>BatchMode=yes</code>, so the client's key must already
be in the server account's <code>authorized_keys</code>, or loaded in
<code>ssh-agent</code>: cron cannot answer a password prompt.</p>
</div>
<h2 id="first">The first sync</h2>
<p>Look before you leap. <code>--dry-run</code> prints the actions the session
would take without changing either side.</p>
<pre><code>filesync sync --repo documents --dry-run
filesync sync --repo documents</code></pre>
( run in 1.336 second using v1.01-cache-2.11-cpan-f5f21f1076c )