Debian Codegraph @

rrsync.1.html

raw symbols SCIP
1 <html><head>
2 <title>rrsync(1) manpage</title>
3 <meta charset="UTF-8"/>
4 <link href="https://fonts.googleapis.com/css2?family=Roboto&family=Roboto+Mono&display=swap" rel="stylesheet">
5 <style>
6 body {
7 max-width: 50em;
8 margin: auto;
9 }
10 body, b, strong, u {
11 font-family: 'Roboto', sans-serif;
12 }
13 a.tgt { font-face: symbol; font-weight: 400; font-size: 70%; visibility: hidden; text-decoration: none; color: #ddd; padding: 0 4px; border: 0; }
14 a.tgt:after { content: '🔗'; }
15 a.tgt:hover { color: #444; background-color: #eaeaea; }
16 h1:hover > a.tgt, h2:hover > a.tgt, h3:hover > a.tgt, dt:hover > a.tgt { visibility: visible; }
17 code {
18 font-family: 'Roboto Mono', monospace;
19 font-weight: bold;
20 white-space: pre;
21 }
22 pre code {
23 display: block;
24 font-weight: normal;
25 }
26 blockquote pre code {
27 background: #f1f1f1;
28 }
29 dd p:first-of-type {
30 margin-block-start: 0em;
31 }
32 </style>
33 </head><body>
34 <h2 id="NAME">NAME<a href="#NAME" class="tgt"></a></h2>
35 <p>rrsync -&#8288; a script to setup restricted rsync users via ssh logins</p>
36 <h2 id="SYNOPSIS">SYNOPSIS<a href="#SYNOPSIS" class="tgt"></a></h2>
37 <pre><code>rrsync [-ro|-wo] [-munge] [-absolute] [-no-del] [-no-lock] [-no-overwrite] DIR
38 </code></pre>
39 <p>The single non-option argument specifies the restricted <u>DIR</u> to use. It can be
40 relative to the user's home directory or an absolute path.</p>
41 <p>The online version of this manpage (that includes cross-linking of topics)
42 is available at <a href="https://download.samba.org/pub/rsync/rrsync.1">https://download.samba.org/pub/rsync/rrsync.1</a>.</p>
43 <h2 id="DESCRIPTION">DESCRIPTION<a href="#DESCRIPTION" class="tgt"></a></h2>
44 <p>A user's ssh login can be restricted to only allow the running of an rsync
45 transfer in one of two easy ways:</p>
46 <ul>
47 <li>forcing the running of the rrsync script</li>
48 <li>forcing the running of an rsync daemon-over-ssh command.</li>
49 </ul>
50 <p>Both of these setups use a feature of ssh that allows a command to be forced to
51 run instead of an interactive shell. However, if the user's home shell is bash,
52 please see <a href="#BASH_SECURITY_ISSUE">BASH SECURITY ISSUE</a> for a potential issue.</p>
53 <p>To use the rrsync script, edit the user's <code>~/.ssh/authorized_keys</code> file and add
54 a prefix like one of the following (followed by a space) in front of each
55 ssh-key line that should be restricted:</p>
56 <blockquote>
57 <pre><code>command=&quot;rrsync DIR&quot;
58 command=&quot;rrsync -ro DIR&quot;
59 command=&quot;rrsync -munge -no-del DIR&quot;
60 </code></pre>
61 </blockquote>
62 <p>Then, ensure that the rrsync script has your desired option restrictions. You
63 may want to copy the script to a local bin dir with a unique name if you want
64 to have multiple configurations. One or more rrsync options can be specified
65 prior to the <u>DIR</u> if you want to further restrict the transfer.</p>
66 <p>To use an rsync daemon setup, edit the user's <code>~/.ssh/authorized_keys</code> file and
67 add a prefix like one of the following (followed by a space) in front of each
68 ssh-key line that should be restricted:</p>
69 <blockquote>
70 <pre><code>command=&quot;rsync --server --daemon .&quot;
71 command=&quot;rsync --server --daemon --config=/PATH/TO/rsyncd.conf .&quot;
72 </code></pre>
73 </blockquote>
74 <p>Then, ensure that the rsyncd.conf file is created with one or more module names
75 with the appropriate path and option restrictions. If rsync's
76 <a href="rsync.1#dopt--config"><code>--config</code></a> option is omitted, it defaults to <code>~/rsyncd.conf</code>.
77 See the <a href="rsyncd.conf.5"><strong>rsyncd.conf</strong>(5)</a> manpage for details of how to
78 configure an rsync daemon.</p>
79 <p>When using rrsync, there can be just one restricted dir per authorized key. A
80 daemon setup, on the other hand, allows multiple module names inside the config
81 file, each one with its own path setting.</p>
82 <p>The remainder of this manpage is dedicated to using the rrsync script.</p>
83 <h2 id="OPTIONS">OPTIONS<a href="#OPTIONS" class="tgt"></a></h2>
84 <dl>
85
86 <dt id="opt-ro"><code>-ro</code><a href="#opt-ro" class="tgt"></a></dt><dd>
87 <p>Allow only reading from the DIR. Implies <a href="#opt-no-del"><code>-no-del</code></a> and
88 <a href="#opt-no-lock"><code>-no-lock</code></a>.</p>
89 </dd>
90
91 <dt id="opt-wo"><code>-wo</code><a href="#opt-wo" class="tgt"></a></dt><dd>
92 <p>Allow only writing to the DIR.</p>
93 </dd>
94
95 <dt id="opt-munge"><code>-munge</code><a href="#opt-munge" class="tgt"></a></dt><dd>
96 <p>Enable rsync's <a href="rsync.1#opt--munge-links"><code>--munge-links</code></a> on the server side.</p>
97 </dd>
98
99 <dt id="opt-absolute"><code>-absolute</code><a href="#opt-absolute" class="tgt"></a></dt><dd>
100 <p>Allow file-transfer arguments to name the restricted directory using its
101 absolute server path. For example, with <code>rrsync -absolute /path/to/root</code>,
102 the transfer arg <code>/path/to/root/dir1</code> is accepted as an alias for <code>dir1</code>.</p>
103 </dd>
104
105 <dt id="opt-no-del"><code>-no-del</code><a href="#opt-no-del" class="tgt"></a></dt><dd>
106 <p>Disable rsync's <code>--delete*</code> and <code>--remove*</code> options.</p>
107 </dd>
108
109 <dt id="opt-no-lock"><code>-no-lock</code><a href="#opt-no-lock" class="tgt"></a></dt><dd>
110 <p>Avoid the single-run (per-user) lock check. Useful with <a href="#opt-munge"><code>-munge</code></a>.</p>
111 </dd>
112
113 <dt id="opt-no-overwrite"><code>-no-overwrite</code><a href="#opt-no-overwrite" class="tgt"></a></dt><dd>
114 <p>Enforce <code>--ignore-existing</code> on the server. Prevents overwriting existing
115 files when the server is the receiver.</p>
116 <p>Because <code>--ignore-existing</code> protects only the file being transferred, this
117 also refuses the options that can reach a <u>different</u> existing file in the
118 restricted dir: <code>--log-file</code>, <code>--partial-dir</code>, <code>--delay-updates</code>, and
119 backup mode (<code>-b</code>, <code>--backup-dir</code>, whose published backup replaces whatever
120 already occupies the backup name). Resumable uploads with an explicit
121 <code>--partial-dir</code>, <code>--delay-updates</code>, and server-side logging are therefore
122 unavailable under this option.</p>
123 </dd>
124
125 <span id="opt-h"></span><dt id="opt-help"><code>-help</code>, <code>-h</code><a href="#opt-help" class="tgt"></a></dt><dd>
126 <p>Output this help message and exit.</p>
127 </dd>
128 </dl>
129 <h2 id="SECURITY_RESTRICTIONS">SECURITY RESTRICTIONS<a href="#SECURITY_RESTRICTIONS" class="tgt"></a></h2>
130 <p>The rrsync script validates the path arguments it is sent to try to restrict
131 them to staying within the specified DIR.</p>
132 <p>The rrsync script rejects rsync's <a href="rsync.1#opt--copy-links"><code>--copy-links</code></a> option (by
133 default) so that a copy cannot dereference a symlink within the DIR to get to a
134 file outside the DIR.</p>
135 <p>The rrsync script rejects rsync's <a href="rsync.1#opt--protect-args"><code>--protect-args</code></a> (<code>-s</code>) option
136 because it would allow options to be sent to the server-side that the script
137 cannot check. If you want to support <code>--protect-args</code>, use a daemon-over-ssh
138 setup.</p>
139 <p>The rrsync script accepts just a subset of rsync's options that the real rsync
140 uses when running the server command. A few extra convenience options are also
141 included to help it to interact with BackupPC and accept some convenient user
142 overrides.</p>
143 <p>The script (or a copy of it) can be manually edited if you want it to customize
144 the option handling.</p>
145 <h2 id="BASH_SECURITY_ISSUE">BASH SECURITY ISSUE<a href="#BASH_SECURITY_ISSUE" class="tgt"></a></h2>
146 <p>If your users have bash set as their home shell, bash may try to be overly
147 helpful and ensure that the user's login bashrc files are run prior to
148 executing the forced command. This can be a problem if the user can somehow
149 update their home bashrc files, perhaps via the restricted copy, a shared home
150 directory, or something similar.</p>
151 <p>One simple way to avoid the issue is to switch the user to a simpler shell,
152 such as dash. When choosing the new home shell, make sure that you're not
153 choosing bash in disguise, as it is unclear if it avoids the security issue.</p>
154 <p>Another potential fix is to ensure that the user's home directory is not a
155 shared mount and that they have no means of copying files outside of their
156 restricted directories. This may require you to force the enabling of symlink
157 munging on the server side.</p>
158 <p>A future version of openssh may have a change to the handling of forced
159 commands that allows it to avoid using the user's home shell.</p>
160 <h2 id="EXAMPLES">EXAMPLES<a href="#EXAMPLES" class="tgt"></a></h2>
161 <p>The <code>~/.ssh/authorized_keys</code> file might have lines in it like this:</p>
162 <blockquote>
163 <pre><code>command=&quot;rrsync client/logs&quot; ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEAzG...
164 command=&quot;rrsync -ro results&quot; ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEAmk...
165 </code></pre>
166 </blockquote>
167 <h2 id="FILES">FILES<a href="#FILES" class="tgt"></a></h2>
168 <p>~/.ssh/authorized_keys</p>
169 <h2 id="SEE_ALSO">SEE ALSO<a href="#SEE_ALSO" class="tgt"></a></h2>
170 <p><a href="rsync.1"><strong>rsync</strong>(1)</a>, <a href="rsyncd.conf.5"><strong>rsyncd.conf</strong>(5)</a></p>
171 <h2 id="VERSION">VERSION<a href="#VERSION" class="tgt"></a></h2>
172 <p>This manpage is current for version 3.5.0 of rsync.</p>
173 <h2 id="CREDITS">CREDITS<a href="#CREDITS" class="tgt"></a></h2>
174 <p>rsync is distributed under the GNU General Public License. See the file
175 <a href="COPYING">COPYING</a> for details.</p>
176 <p>An rsync web site is available at <a href="https://rsync.samba.org/">https://rsync.samba.org/</a> and its github
177 project is <a href="https://github.com/RsyncProject/rsync">https://github.com/RsyncProject/rsync</a>.</p>
178 <h2 id="AUTHOR">AUTHOR<a href="#AUTHOR" class="tgt"></a></h2>
179 <p>The original rrsync perl script was written by Joe Smith. Many people have
180 later contributed to it. The python version was created by Wayne Davison.</p>
181 <div style="float: right"><p><i>13 Aug 2026</i></p></div>
182 </body></html>