]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - crypto/openssh/scp.1
freebsd32: Report errors when copying out oldlenp in __sysctl
[FreeBSD/FreeBSD.git] / crypto / openssh / scp.1
1 .\"
2 .\" scp.1
3 .\"
4 .\" Author: Tatu Ylonen <ylo@cs.hut.fi>
5 .\"
6 .\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
7 .\"                    All rights reserved
8 .\"
9 .\" Created: Sun May  7 00:14:37 1995 ylo
10 .\"
11 .\" $OpenBSD: scp.1,v 1.112 2022/12/16 07:13:22 djm Exp $
12 .\"
13 .Dd $Mdocdate: December 16 2022 $
14 .Dt SCP 1
15 .Os
16 .Sh NAME
17 .Nm scp
18 .Nd OpenSSH secure file copy
19 .Sh SYNOPSIS
20 .Nm scp
21 .Op Fl 346ABCOpqRrsTv
22 .Op Fl c Ar cipher
23 .Op Fl D Ar sftp_server_path
24 .Op Fl F Ar ssh_config
25 .Op Fl i Ar identity_file
26 .Op Fl J Ar destination
27 .Op Fl l Ar limit
28 .Op Fl o Ar ssh_option
29 .Op Fl P Ar port
30 .Op Fl S Ar program
31 .Op Fl X Ar sftp_option
32 .Ar source ... target
33 .Sh DESCRIPTION
34 .Nm
35 copies files between hosts on a network.
36 .Pp
37 .Nm
38 uses the SFTP protocol over a
39 .Xr ssh 1
40 connection for data transfer, and uses the same authentication and provides
41 the same security as a login session.
42 .Pp
43 .Nm
44 will ask for passwords or passphrases if they are needed for
45 authentication.
46 .Pp
47 The
48 .Ar source
49 and
50 .Ar target
51 may be specified as a local pathname, a remote host with optional path
52 in the form
53 .Sm off
54 .Oo user @ Oc host : Op path ,
55 .Sm on
56 or a URI in the form
57 .Sm off
58 .No scp:// Oo user @ Oc host Oo : port Oc Op / path .
59 .Sm on
60 Local file names can be made explicit using absolute or relative pathnames
61 to avoid
62 .Nm
63 treating file names containing
64 .Sq :\&
65 as host specifiers.
66 .Pp
67 When copying between two remote hosts, if the URI format is used, a
68 .Ar port
69 cannot be specified on the
70 .Ar target
71 if the
72 .Fl R
73 option is used.
74 .Pp
75 The options are as follows:
76 .Bl -tag -width Ds
77 .It Fl 3
78 Copies between two remote hosts are transferred through the local host.
79 Without this option the data is copied directly between the two remote
80 hosts.
81 Note that, when using the original SCP protocol (the default), this option
82 selects batch mode for the second host as
83 .Nm
84 cannot ask for passwords or passphrases for both hosts.
85 This mode is the default.
86 .It Fl 4
87 Forces
88 .Nm
89 to use IPv4 addresses only.
90 .It Fl 6
91 Forces
92 .Nm
93 to use IPv6 addresses only.
94 .It Fl A
95 Allows forwarding of
96 .Xr ssh-agent 1
97 to the remote system.
98 The default is not to forward an authentication agent.
99 .It Fl B
100 Selects batch mode (prevents asking for passwords or passphrases).
101 .It Fl C
102 Compression enable.
103 Passes the
104 .Fl C
105 flag to
106 .Xr ssh 1
107 to enable compression.
108 .It Fl c Ar cipher
109 Selects the cipher to use for encrypting the data transfer.
110 This option is directly passed to
111 .Xr ssh 1 .
112 .It Fl D Ar sftp_server_path
113 Connect directly to a local SFTP server program rather than a
114 remote one via
115 .Xr ssh 1 .
116 This option may be useful in debugging the client and server.
117 .It Fl F Ar ssh_config
118 Specifies an alternative
119 per-user configuration file for
120 .Nm ssh .
121 This option is directly passed to
122 .Xr ssh 1 .
123 .It Fl i Ar identity_file
124 Selects the file from which the identity (private key) for public key
125 authentication is read.
126 This option is directly passed to
127 .Xr ssh 1 .
128 .It Fl J Ar destination
129 Connect to the target host by first making an
130 .Nm
131 connection to the jump host described by
132 .Ar destination
133 and then establishing a TCP forwarding to the ultimate destination from
134 there.
135 Multiple jump hops may be specified separated by comma characters.
136 This is a shortcut to specify a
137 .Cm ProxyJump
138 configuration directive.
139 This option is directly passed to
140 .Xr ssh 1 .
141 .It Fl l Ar limit
142 Limits the used bandwidth, specified in Kbit/s.
143 .It Fl O
144 Use the original SCP protocol for file transfers instead of the SFTP protocol.
145 Forcing the use of the SCP protocol may be necessary for servers that do
146 not implement SFTP, for backwards-compatibility for particular filename
147 wildcard patterns and for expanding paths with a
148 .Sq ~
149 prefix for older SFTP servers.
150 This mode is the default.
151 .It Fl o Ar ssh_option
152 Can be used to pass options to
153 .Nm ssh
154 in the format used in
155 .Xr ssh_config 5 .
156 This is useful for specifying options
157 for which there is no separate
158 .Nm scp
159 command-line flag.
160 For full details of the options listed below, and their possible values, see
161 .Xr ssh_config 5 .
162 .Pp
163 .Bl -tag -width Ds -offset indent -compact
164 .It AddressFamily
165 .It BatchMode
166 .It BindAddress
167 .It BindInterface
168 .It CanonicalDomains
169 .It CanonicalizeFallbackLocal
170 .It CanonicalizeHostname
171 .It CanonicalizeMaxDots
172 .It CanonicalizePermittedCNAMEs
173 .It CASignatureAlgorithms
174 .It CertificateFile
175 .It CheckHostIP
176 .It Ciphers
177 .It Compression
178 .It ConnectionAttempts
179 .It ConnectTimeout
180 .It ControlMaster
181 .It ControlPath
182 .It ControlPersist
183 .It GlobalKnownHostsFile
184 .It GSSAPIAuthentication
185 .It GSSAPIDelegateCredentials
186 .It HashKnownHosts
187 .It Host
188 .It HostbasedAcceptedAlgorithms
189 .It HostbasedAuthentication
190 .It HostKeyAlgorithms
191 .It HostKeyAlias
192 .It Hostname
193 .It IdentitiesOnly
194 .It IdentityAgent
195 .It IdentityFile
196 .It IPQoS
197 .It KbdInteractiveAuthentication
198 .It KbdInteractiveDevices
199 .It KexAlgorithms
200 .It KnownHostsCommand
201 .It LogLevel
202 .It MACs
203 .It NoHostAuthenticationForLocalhost
204 .It NumberOfPasswordPrompts
205 .It PasswordAuthentication
206 .It PKCS11Provider
207 .It Port
208 .It PreferredAuthentications
209 .It ProxyCommand
210 .It ProxyJump
211 .It PubkeyAcceptedAlgorithms
212 .It PubkeyAuthentication
213 .It RekeyLimit
214 .It RequiredRSASize
215 .It SendEnv
216 .It ServerAliveInterval
217 .It ServerAliveCountMax
218 .It SetEnv
219 .It StrictHostKeyChecking
220 .It TCPKeepAlive
221 .It UpdateHostKeys
222 .It User
223 .It UserKnownHostsFile
224 .It VerifyHostKeyDNS
225 .El
226 .It Fl P Ar port
227 Specifies the port to connect to on the remote host.
228 Note that this option is written with a capital
229 .Sq P ,
230 because
231 .Fl p
232 is already reserved for preserving the times and mode bits of the file.
233 .It Fl p
234 Preserves modification times, access times, and file mode bits from the
235 source file.
236 .It Fl q
237 Quiet mode: disables the progress meter as well as warning and diagnostic
238 messages from
239 .Xr ssh 1 .
240 .It Fl R
241 Copies between two remote hosts are performed by connecting to the origin
242 host and executing
243 .Nm
244 there.
245 This requires that
246 .Nm
247 running on the origin host can authenticate to the destination host without
248 requiring a password.
249 .It Fl r
250 Recursively copy entire directories.
251 Note that
252 .Nm
253 follows symbolic links encountered in the tree traversal.
254 .It Fl S Ar program
255 Name of
256 .Ar program
257 to use for the encrypted connection.
258 The program must understand
259 .Xr ssh 1
260 options.
261 .It Fl s
262 Use the SFTP protocol for transfers rather than the original scp protocol.
263 .It Fl T
264 Disable strict filename checking.
265 By default when copying files from a remote host to a local directory
266 .Nm
267 checks that the received filenames match those requested on the command-line
268 to prevent the remote end from sending unexpected or unwanted files.
269 Because of differences in how various operating systems and shells interpret
270 filename wildcards, these checks may cause wanted files to be rejected.
271 This option disables these checks at the expense of fully trusting that
272 the server will not send unexpected filenames.
273 .It Fl v
274 Verbose mode.
275 Causes
276 .Nm
277 and
278 .Xr ssh 1
279 to print debugging messages about their progress.
280 This is helpful in
281 debugging connection, authentication, and configuration problems.
282 .It Fl X Ar sftp_option
283 Specify an option that controls aspects of SFTP protocol behaviour.
284 The valid options are:
285 .Bl -tag -width Ds
286 .It Cm nrequests Ns = Ns Ar value
287 Controls how many concurrent SFTP read or write requests may be in progress
288 at any point in time during a download or upload.
289 By default 64 requests may be active concurrently.
290 .It Cm buffer Ns = Ns Ar value
291 Controls the maximum buffer size for a single SFTP read/write operation used
292 during download or upload.
293 By default a 32KB buffer is used.
294 .El
295 .El
296 .Sh EXIT STATUS
297 .Ex -std scp
298 .Sh SEE ALSO
299 .Xr sftp 1 ,
300 .Xr ssh 1 ,
301 .Xr ssh-add 1 ,
302 .Xr ssh-agent 1 ,
303 .Xr ssh-keygen 1 ,
304 .Xr ssh_config 5 ,
305 .Xr sftp-server 8 ,
306 .Xr sshd 8
307 .Sh HISTORY
308 .Nm
309 is based on the rcp program in
310 .Bx
311 source code from the Regents of the University of California.
312 .Sh AUTHORS
313 .An Timo Rinne Aq Mt tri@iki.fi
314 .An Tatu Ylonen Aq Mt ylo@cs.hut.fi
315 .Sh CAVEATS
316 The original SCP protocol (used by default) requires execution of the
317 remote user's shell to perform
318 .Xr glob 3
319 pattern matching.
320 This requires careful quoting of any characters that have special meaning to
321 the remote shell, such as quote characters.