Debian Codegraph @

rrsync.1

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