xref: /freebsd/crypto/openssh/sftp-server.8 (revision f9bc005b8ef3b507a5ecbc2d7fe4411ef70eff38)
1.\" $OpenBSD: sftp-server.8,v 1.32 2026/05/21 02:50:59 djm Exp $
2.\"
3.\" Copyright (c) 2000 Markus Friedl.  All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\"
14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24.\"
25.Dd $Mdocdate: May 21 2026 $
26.Dt SFTP-SERVER 8
27.Os
28.Sh NAME
29.Nm sftp-server
30.Nd OpenSSH SFTP server subsystem
31.Sh SYNOPSIS
32.Nm sftp-server
33.Bk -words
34.Op Fl ehR
35.Op Fl d Ar start_directory
36.Op Fl f Ar log_facility
37.Op Fl l Ar log_level
38.Op Fl P Ar denied_requests
39.Op Fl p Ar allowed_requests
40.Op Fl u Ar umask
41.Ek
42.Nm
43.Fl Q Ar protocol_feature
44.Sh DESCRIPTION
45.Nm
46is a program that speaks the server side of SFTP protocol
47to stdout and expects client requests from stdin.
48.Nm
49is not intended to be called directly, but from
50.Xr sshd 8
51using the
52.Cm Subsystem
53option.
54.Pp
55Command-line flags to
56.Nm
57should be specified in the
58.Cm Subsystem
59declaration.
60See
61.Xr sshd_config 5
62for more information.
63.Pp
64Valid options are:
65.Bl -tag -width Ds
66.It Fl d Ar start_directory
67Specifies an alternate starting directory for users.
68The pathname may contain the following tokens that are expanded at runtime:
69%% is replaced by a literal '%',
70%d is replaced by the home directory of the user being authenticated,
71and %u is replaced by the username of that user.
72The default is to use the user's home directory.
73This option is useful in conjunction with the
74.Xr sshd_config 5
75.Cm ChrootDirectory
76option.
77.It Fl e
78Causes
79.Nm
80to print logging information to stderr instead of syslog for debugging.
81.It Fl f Ar log_facility
82Specifies the facility code that is used when logging messages from
83.Nm .
84The possible values are: DAEMON, USER, AUTH, LOCAL0, LOCAL1, LOCAL2,
85LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7.
86The default is AUTH.
87.It Fl h
88Displays
89.Nm
90usage information.
91.It Fl l Ar log_level
92Specifies which messages will be logged by
93.Nm .
94The possible values are:
95QUIET, FATAL, ERROR, INFO, VERBOSE, DEBUG, DEBUG1, DEBUG2, and DEBUG3.
96INFO and VERBOSE log transactions that
97.Nm
98performs on behalf of the client.
99DEBUG and DEBUG1 are equivalent.
100DEBUG2 and DEBUG3 each specify higher levels of debugging output.
101The default is ERROR.
102.It Fl P Ar denied_requests
103Specifies a comma-separated list of SFTP protocol requests that are banned by
104the server.
105.Nm
106will reply to any denied request with a failure.
107The
108.Fl Q
109flag can be used to determine the supported request types.
110If both denied and allowed lists are specified, then the denied list is
111applied before the allowed list.
112This flag, along with the
113.Fl p
114flag, may be used to disable operations that are irrelevant or undesirable
115for the server.
116For example, a
117.Nm
118that accepts connections from untrusted clients may wish to disable the
119.Dq copy-data
120or
121.Dq users-groups-by-id
122operations.
123.It Fl p Ar allowed_requests
124Specifies a comma-separated list of SFTP protocol requests that are permitted
125by the server.
126All request types that are not on the allowed list will be logged and replied
127to with a failure message.
128.Pp
129Care must be taken when using this feature to ensure that requests made
130implicitly by SFTP clients are permitted.
131.It Fl Q Ar protocol_feature
132Queries protocol features supported by
133.Nm .
134At present the only feature that may be queried is
135.Dq requests ,
136which may be used to deny or allow specific requests (flags
137.Fl P
138and
139.Fl p
140respectively).
141.It Fl R
142Places this instance of
143.Nm
144into a read-only mode.
145Attempts to open files for writing, as well as other operations that change
146the state of the filesystem, will be denied.
147.It Fl u Ar umask
148Sets an explicit
149.Xr umask 2
150to be applied to newly-created files and directories, instead of the
151user's default mask.
152.El
153.Pp
154On some systems,
155.Nm
156must be able to access
157.Pa /dev/log
158for logging to work, and use of
159.Nm
160in a chroot configuration therefore requires that
161.Xr syslogd 8
162establish a logging socket inside the chroot directory.
163.Sh SEE ALSO
164.Xr sftp 1 ,
165.Xr ssh 1 ,
166.Xr sshd_config 5 ,
167.Xr sshd 8
168.Rs
169.%A T. Ylonen
170.%A S. Lehtinen
171.%T "SSH File Transfer Protocol"
172.%N draft-ietf-secsh-filexfer-02.txt
173.%D October 2001
174.%O work in progress material
175.Re
176.Sh HISTORY
177.Nm
178first appeared in
179.Ox 2.8 .
180.Sh AUTHORS
181.An Markus Friedl Aq Mt markus@openbsd.org
182