xref: /dflybsd-src/libexec/ftpd/ftpchroot.5 (revision 86d7f5d305c6adaa56ff4582ece9859d73106103)
186d7f5d3SJohn Marino.\" Copyright (c) 2003 FreeBSD Project
286d7f5d3SJohn Marino.\" All rights reserved.
386d7f5d3SJohn Marino.\"
486d7f5d3SJohn Marino.\" Redistribution and use in source and binary forms, with or without
586d7f5d3SJohn Marino.\" modification, are permitted provided that the following conditions
686d7f5d3SJohn Marino.\" are met:
786d7f5d3SJohn Marino.\" 1. Redistributions of source code must retain the above copyright
886d7f5d3SJohn Marino.\"    notice, this list of conditions and the following disclaimer.
986d7f5d3SJohn Marino.\" 2. Redistributions in binary form must reproduce the above copyright
1086d7f5d3SJohn Marino.\"    notice, this list of conditions and the following disclaimer in the
1186d7f5d3SJohn Marino.\"    documentation and/or other materials provided with the distribution.
1286d7f5d3SJohn Marino.\"
1386d7f5d3SJohn Marino.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1486d7f5d3SJohn Marino.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1586d7f5d3SJohn Marino.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1686d7f5d3SJohn Marino.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1786d7f5d3SJohn Marino.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1886d7f5d3SJohn Marino.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1986d7f5d3SJohn Marino.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2086d7f5d3SJohn Marino.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2186d7f5d3SJohn Marino.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2286d7f5d3SJohn Marino.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2386d7f5d3SJohn Marino.\" SUCH DAMAGE.
2486d7f5d3SJohn Marino.\"
2586d7f5d3SJohn Marino.\" $FreeBSD: src/libexec/ftpd/ftpchroot.5,v 1.3 2003/06/01 19:52:36 ru Exp $
2686d7f5d3SJohn Marino.\" $DragonFly: src/libexec/ftpd/ftpchroot.5,v 1.4 2007/05/17 08:19:01 swildner Exp $
2786d7f5d3SJohn Marino.\"
2886d7f5d3SJohn Marino.Dd January 26, 2003
2986d7f5d3SJohn Marino.Dt FTPCHROOT 5
3086d7f5d3SJohn Marino.Os
3186d7f5d3SJohn Marino.Sh NAME
3286d7f5d3SJohn Marino.Nm ftpchroot
3386d7f5d3SJohn Marino.Nd "list users and groups subject to FTP access restrictions"
3486d7f5d3SJohn Marino.Sh DESCRIPTION
3586d7f5d3SJohn MarinoThe file
3686d7f5d3SJohn Marino.Nm
3786d7f5d3SJohn Marinois read by
3886d7f5d3SJohn Marino.Xr ftpd 8
3986d7f5d3SJohn Marinoat the beginning of an FTP session, after having authenticated the user.
4086d7f5d3SJohn MarinoEach line in
4186d7f5d3SJohn Marino.Nm
4286d7f5d3SJohn Marinocorresponds to a user or group.
4386d7f5d3SJohn MarinoIf a line in
4486d7f5d3SJohn Marino.Nm
4586d7f5d3SJohn Marinomatches the current user or a group he is a member of,
4686d7f5d3SJohn Marinoaccess restrictions will be applied to this
4786d7f5d3SJohn Marinosession by changing its root directory with
4886d7f5d3SJohn Marino.Xr chroot 2
4986d7f5d3SJohn Marinoto that specified on the line or to the user's login directory.
5086d7f5d3SJohn Marino.Pp
5186d7f5d3SJohn MarinoThe order of records in
5286d7f5d3SJohn Marino.Nm
5386d7f5d3SJohn Marinois important because the first match will be used.
5486d7f5d3SJohn MarinoFields on each line are separated by tabs or spaces.
5586d7f5d3SJohn Marino.Pp
5686d7f5d3SJohn MarinoThe first field specifies a user or group name.
5786d7f5d3SJohn MarinoIf it is prefixed by an
5886d7f5d3SJohn Marino.Dq at
5986d7f5d3SJohn Marinosign,
6086d7f5d3SJohn Marino.Ql @ ,
6186d7f5d3SJohn Marinoit specifies a group name;
6286d7f5d3SJohn Marinothe line will match each user who is a member of this group.
6386d7f5d3SJohn MarinoAs a special case, a single
6486d7f5d3SJohn Marino.Ql @
6586d7f5d3SJohn Marinoin this field will match any user.
6686d7f5d3SJohn MarinoA username is specified otherwise.
6786d7f5d3SJohn Marino.Pp
6886d7f5d3SJohn MarinoThe optional second field describes the directory for the user
6986d7f5d3SJohn Marinoor each member of the group to be locked up in using
7086d7f5d3SJohn Marino.Xr chroot 2 .
7186d7f5d3SJohn MarinoBe it omitted, the user's login directory will be used.
7286d7f5d3SJohn MarinoIf it is not an absolute pathname, then it will be relative
7386d7f5d3SJohn Marinoto the user's login directory.
7486d7f5d3SJohn MarinoIf it contains the
7586d7f5d3SJohn Marino.Pa /./
7686d7f5d3SJohn Marinoseparator,
7786d7f5d3SJohn Marino.Xr ftpd 8
7886d7f5d3SJohn Marinowill treat its left-hand side as the name of the directory to do
7986d7f5d3SJohn Marino.Xr chroot 2
8086d7f5d3SJohn Marinoto, and its right-hand side to change the current directory to afterwards.
8186d7f5d3SJohn Marino.Sh FILES
8286d7f5d3SJohn Marino.Bl -tag -width ".Pa /etc/ftpchroot" -compact
8386d7f5d3SJohn Marino.It Pa /etc/ftpchroot
8486d7f5d3SJohn Marino.El
8586d7f5d3SJohn Marino.Sh EXAMPLES
8686d7f5d3SJohn MarinoThese lines in
8786d7f5d3SJohn Marino.Nm
8886d7f5d3SJohn Marinowill lock up the user
8986d7f5d3SJohn Marino.Dq Li webuser
9086d7f5d3SJohn Marinoand each member of the group
9186d7f5d3SJohn Marino.Dq Li hostee
9286d7f5d3SJohn Marinoin their respective login directories:
9386d7f5d3SJohn Marino.Bd -literal -offset indent
9486d7f5d3SJohn Marinowebuser
9586d7f5d3SJohn Marino@hostee
9686d7f5d3SJohn Marino.Ed
9786d7f5d3SJohn Marino.Pp
9886d7f5d3SJohn MarinoAnd this line will tell
9986d7f5d3SJohn Marino.Xr ftpd 8
10086d7f5d3SJohn Marinoto lock up the user
10186d7f5d3SJohn Marino.Dq Li joe
10286d7f5d3SJohn Marinoin
10386d7f5d3SJohn Marino.Pa /var/spool/ftp
10486d7f5d3SJohn Marinoand then to change the current directory to
10586d7f5d3SJohn Marino.Pa /joe ,
10686d7f5d3SJohn Marinowhich is relative to the session's new root:
10786d7f5d3SJohn Marino.Pp
10886d7f5d3SJohn Marino.Dl "joe	/var/spool/ftp/./joe"
10986d7f5d3SJohn Marino.Pp
11086d7f5d3SJohn MarinoAnd finally the following line will lock up every user connecting
11186d7f5d3SJohn Marinothrough FTP in his respective
11286d7f5d3SJohn Marino.Pa ~/public_html ,
11386d7f5d3SJohn Marinothus lowering possible impact on the system
11486d7f5d3SJohn Marinofrom intrinsic insecurity of FTP:
11586d7f5d3SJohn Marino.Pp
11686d7f5d3SJohn Marino.Dl "@	public_html"
11786d7f5d3SJohn Marino.Sh SEE ALSO
11886d7f5d3SJohn Marino.Xr chroot 2 ,
11986d7f5d3SJohn Marino.Xr group 5 ,
12086d7f5d3SJohn Marino.Xr passwd 5 ,
12186d7f5d3SJohn Marino.Xr ftpd 8
122