xref: /netbsd-src/crypto/external/bsd/openssh/dist/scp.1 (revision c001be21e5338c9a203ee43d40015a36715e972c)
1*c001be21Sws.\"	$NetBSD: scp.1,v 1.31 2023/12/01 12:07:19 ws Exp $
2ca32bd8dSchristos.\"
3ca32bd8dSchristos.\" scp.1
4ca32bd8dSchristos.\"
5ca32bd8dSchristos.\" Author: Tatu Ylonen <ylo@cs.hut.fi>
6ca32bd8dSchristos.\"
7ca32bd8dSchristos.\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
8ca32bd8dSchristos.\"                    All rights reserved
9ca32bd8dSchristos.\"
10ca32bd8dSchristos.\" Created: Sun May  7 00:14:37 1995 ylo
11ca32bd8dSchristos.\"
12b1066cf3Schristos.\" $OpenBSD: scp.1,v 1.112 2022/12/16 07:13:22 djm Exp $
13ca32bd8dSchristos.\"
14b1066cf3Schristos.Dd December 16 2022
15ca32bd8dSchristos.Dt SCP 1
16ca32bd8dSchristos.Os
17ca32bd8dSchristos.Sh NAME
18ca32bd8dSchristos.Nm scp
19ed75d7a8Schristos.Nd OpenSSH secure file copy
20ca32bd8dSchristos.Sh SYNOPSIS
21ca32bd8dSchristos.Nm scp
22b592f463Schristos.Op Fl 346ABCOpqRrsTv
23ca32bd8dSchristos.Op Fl c Ar cipher
24b592f463Schristos.Op Fl D Ar sftp_server_path
25ca32bd8dSchristos.Op Fl F Ar ssh_config
26ca32bd8dSchristos.Op Fl i Ar identity_file
27aa36fcacSchristos.Op Fl J Ar destination
28ca32bd8dSchristos.Op Fl l Ar limit
29ca32bd8dSchristos.Op Fl o Ar ssh_option
30ca32bd8dSchristos.Op Fl P Ar port
31ca32bd8dSchristos.Op Fl S Ar program
32b1066cf3Schristos.Op Fl X Ar sftp_option
33ffae97bbSchristos.Ar source ... target
34ca32bd8dSchristos.Sh DESCRIPTION
35ca32bd8dSchristos.Nm
36ca32bd8dSchristoscopies files between hosts on a network.
3717418e98Schristos.Pp
38b1066cf3Schristos.Nm
39b1066cf3Schristosuses the SFTP protocol over a
40ca32bd8dSchristos.Xr ssh 1
41b1066cf3Schristosconnection for data transfer, and uses the same authentication and provides
42b1066cf3Schristosthe same security as a login session.
4317418e98Schristos.Pp
44ca32bd8dSchristos.Nm
45ca32bd8dSchristoswill ask for passwords or passphrases if they are needed for
46ca32bd8dSchristosauthentication.
47ca32bd8dSchristos.Pp
48ffae97bbSchristosThe
49ffae97bbSchristos.Ar source
50ffae97bbSchristosand
51ffae97bbSchristos.Ar target
52ffae97bbSchristosmay be specified as a local pathname, a remote host with optional path
53ffae97bbSchristosin the form
54ffae97bbSchristos.Sm off
55ffae97bbSchristos.Oo user @ Oc host : Op path ,
56ffae97bbSchristos.Sm on
57ffae97bbSchristosor a URI in the form
58ffae97bbSchristos.Sm off
59ffae97bbSchristos.No scp:// Oo user @ Oc host Oo : port Oc Op / path .
60ffae97bbSchristos.Sm on
61ca32bd8dSchristosLocal file names can be made explicit using absolute or relative pathnames
62ca32bd8dSchristosto avoid
63ca32bd8dSchristos.Nm
64ca32bd8dSchristostreating file names containing
65ca32bd8dSchristos.Sq :\&
66ca32bd8dSchristosas host specifiers.
67ffae97bbSchristos.Pp
68ffae97bbSchristosWhen copying between two remote hosts, if the URI format is used, a
69ffae97bbSchristos.Ar port
70b592f463Schristoscannot be specified on the
71ffae97bbSchristos.Ar target
72ffae97bbSchristosif the
73b592f463Schristos.Fl R
74ffae97bbSchristosoption is used.
75ca32bd8dSchristos.Pp
76ca32bd8dSchristosThe options are as follows:
77ca32bd8dSchristos.Bl -tag -width Ds
78185c8f97Schristos.It Fl 3
79185c8f97SchristosCopies between two remote hosts are transferred through the local host.
80185c8f97SchristosWithout this option the data is copied directly between the two remote
81185c8f97Schristoshosts.
82c4271af5SchristosNote that, when using the legacy SCP protocol (via the
83c4271af5Schristos.Fl O
84c4271af5Schristosflag), this option
85b592f463Schristosselects batch mode for the second host as
868db691beSchristos.Nm
878db691beSchristoscannot ask for passwords or passphrases for both hosts.
88b592f463SchristosThis mode is the default.
89ca32bd8dSchristos.It Fl 4
90ca32bd8dSchristosForces
91ca32bd8dSchristos.Nm
92ca32bd8dSchristosto use IPv4 addresses only.
93ca32bd8dSchristos.It Fl 6
94ca32bd8dSchristosForces
95ca32bd8dSchristos.Nm
96ca32bd8dSchristosto use IPv6 addresses only.
972d3b0f52Schristos.It Fl A
982d3b0f52SchristosAllows forwarding of
992d3b0f52Schristos.Xr ssh-agent 1
1002d3b0f52Schristosto the remote system.
1012d3b0f52SchristosThe default is not to forward an authentication agent.
102ca32bd8dSchristos.It Fl B
103ca32bd8dSchristosSelects batch mode (prevents asking for passwords or passphrases).
104ca32bd8dSchristos.It Fl C
105ca32bd8dSchristosCompression enable.
106ca32bd8dSchristosPasses the
107ca32bd8dSchristos.Fl C
108ca32bd8dSchristosflag to
109ca32bd8dSchristos.Xr ssh 1
110ca32bd8dSchristosto enable compression.
111ca32bd8dSchristos.It Fl c Ar cipher
112ca32bd8dSchristosSelects the cipher to use for encrypting the data transfer.
113ca32bd8dSchristosThis option is directly passed to
114ca32bd8dSchristos.Xr ssh 1 .
115b592f463Schristos.It Fl D Ar sftp_server_path
116b1066cf3SchristosConnect directly to a local SFTP server program rather than a
117b592f463Schristosremote one via
118b592f463Schristos.Xr ssh 1 .
119b592f463SchristosThis option may be useful in debugging the client and server.
120ca32bd8dSchristos.It Fl F Ar ssh_config
121ca32bd8dSchristosSpecifies an alternative
122ca32bd8dSchristosper-user configuration file for
123ca32bd8dSchristos.Nm ssh .
124ca32bd8dSchristosThis option is directly passed to
125ca32bd8dSchristos.Xr ssh 1 .
126ca32bd8dSchristos.It Fl i Ar identity_file
127ca32bd8dSchristosSelects the file from which the identity (private key) for public key
128ca32bd8dSchristosauthentication is read.
129ca32bd8dSchristosThis option is directly passed to
130ca32bd8dSchristos.Xr ssh 1 .
131aa36fcacSchristos.It Fl J Ar destination
132aa36fcacSchristosConnect to the target host by first making an
133aa36fcacSchristos.Nm
134aa36fcacSchristosconnection to the jump host described by
135aa36fcacSchristos.Ar destination
136aa36fcacSchristosand then establishing a TCP forwarding to the ultimate destination from
137aa36fcacSchristosthere.
138aa36fcacSchristosMultiple jump hops may be specified separated by comma characters.
139aa36fcacSchristosThis is a shortcut to specify a
140aa36fcacSchristos.Cm ProxyJump
141aa36fcacSchristosconfiguration directive.
142aa36fcacSchristosThis option is directly passed to
143aa36fcacSchristos.Xr ssh 1 .
144ca32bd8dSchristos.It Fl l Ar limit
145ca32bd8dSchristosLimits the used bandwidth, specified in Kbit/s.
146b592f463Schristos.It Fl O
147c4271af5SchristosUse the legacy SCP protocol for file transfers instead of the SFTP protocol.
148b592f463SchristosForcing the use of the SCP protocol may be necessary for servers that do
149f1ad81b8Schristosnot implement SFTP, for backwards-compatibility for particular filename
150f1ad81b8Schristoswildcard patterns and for expanding paths with a
151f1ad81b8Schristos.Sq ~
152f1ad81b8Schristosprefix for older SFTP servers.
153ca32bd8dSchristos.It Fl o Ar ssh_option
154ca32bd8dSchristosCan be used to pass options to
155ca32bd8dSchristos.Nm ssh
156ca32bd8dSchristosin the format used in
157ca32bd8dSchristos.Xr ssh_config 5 .
158ca32bd8dSchristosThis is useful for specifying options
159ca32bd8dSchristosfor which there is no separate
160ca32bd8dSchristos.Nm scp
161ca32bd8dSchristoscommand-line flag.
162ca32bd8dSchristosFor full details of the options listed below, and their possible values, see
163ca32bd8dSchristos.Xr ssh_config 5 .
164ca32bd8dSchristos.Pp
165ca32bd8dSchristos.Bl -tag -width Ds -offset indent -compact
166ca32bd8dSchristos.It AddressFamily
167ca32bd8dSchristos.It BatchMode
168ca32bd8dSchristos.It BindAddress
169ffae97bbSchristos.It BindInterface
1708a4530f9Schristos.It CanonicalDomains
1718a4530f9Schristos.It CanonicalizeFallbackLocal
1728a4530f9Schristos.It CanonicalizeHostname
1738a4530f9Schristos.It CanonicalizeMaxDots
1748a4530f9Schristos.It CanonicalizePermittedCNAMEs
175aa36fcacSchristos.It CASignatureAlgorithms
17679976551Schristos.It CertificateFile
177ca32bd8dSchristos.It CheckHostIP
178ca32bd8dSchristos.It Ciphers
179ca32bd8dSchristos.It Compression
180ca32bd8dSchristos.It ConnectionAttempts
181ca32bd8dSchristos.It ConnectTimeout
182ca32bd8dSchristos.It ControlMaster
183ca32bd8dSchristos.It ControlPath
184091c4109Schristos.It ControlPersist
185ca32bd8dSchristos.It GlobalKnownHostsFile
186ca32bd8dSchristos.It GSSAPIAuthentication
187ca32bd8dSchristos.It GSSAPIDelegateCredentials
188ca32bd8dSchristos.It HashKnownHosts
189ca32bd8dSchristos.It Host
19017418e98Schristos.It HostbasedAcceptedAlgorithms
191ca32bd8dSchristos.It HostbasedAuthentication
192ca32bd8dSchristos.It HostKeyAlgorithms
193ca32bd8dSchristos.It HostKeyAlias
194cd4ada6aSchristos.It Hostname
195ca32bd8dSchristos.It IdentitiesOnly
1965101d403Schristos.It IdentityAgent
1975101d403Schristos.It IdentityFile
198185c8f97Schristos.It IPQoS
199*c001be21Sws.It IPv6PreferTemporary
200091c4109Schristos.It KbdInteractiveAuthentication
201ca32bd8dSchristos.It KbdInteractiveDevices
202185c8f97Schristos.It KexAlgorithms
20317418e98Schristos.It KnownHostsCommand
204ca32bd8dSchristos.It LogLevel
205ca32bd8dSchristos.It MACs
206ca32bd8dSchristos.It NoHostAuthenticationForLocalhost
207ca32bd8dSchristos.It NumberOfPasswordPrompts
208ca32bd8dSchristos.It PasswordAuthentication
20934b27b53Sadam.It PKCS11Provider
210ca32bd8dSchristos.It Port
211ca32bd8dSchristos.It PreferredAuthentications
212ca32bd8dSchristos.It ProxyCommand
2135101d403Schristos.It ProxyJump
21417418e98Schristos.It PubkeyAcceptedAlgorithms
215ca32bd8dSchristos.It PubkeyAuthentication
216ca32bd8dSchristos.It RekeyLimit
217e160b4e8Schristos.It RequiredRSASize
218ca32bd8dSchristos.It SendEnv
219ca32bd8dSchristos.It ServerAliveInterval
220ca32bd8dSchristos.It ServerAliveCountMax
22155a4608bSchristos.It SetEnv
222ca32bd8dSchristos.It StrictHostKeyChecking
223ca32bd8dSchristos.It TCPKeepAlive
224e4d43b82Schristos.It UpdateHostKeys
225ca32bd8dSchristos.It User
226ca32bd8dSchristos.It UserKnownHostsFile
227ca32bd8dSchristos.It VerifyHostKeyDNS
228ca32bd8dSchristos.El
229ca32bd8dSchristos.It Fl P Ar port
230ca32bd8dSchristosSpecifies the port to connect to on the remote host.
231ca32bd8dSchristosNote that this option is written with a capital
232ca32bd8dSchristos.Sq P ,
233ca32bd8dSchristosbecause
234ca32bd8dSchristos.Fl p
235f1ad81b8Schristosis already reserved for preserving the times and mode bits of the file.
236ca32bd8dSchristos.It Fl p
237f1ad81b8SchristosPreserves modification times, access times, and file mode bits from the
238f1ad81b8Schristossource file.
239ca32bd8dSchristos.It Fl q
240ca32bd8dSchristosQuiet mode: disables the progress meter as well as warning and diagnostic
241ca32bd8dSchristosmessages from
242ca32bd8dSchristos.Xr ssh 1 .
243b592f463Schristos.It Fl R
244b592f463SchristosCopies between two remote hosts are performed by connecting to the origin
245b592f463Schristoshost and executing
246b592f463Schristos.Nm
247b592f463Schristosthere.
248b592f463SchristosThis requires that
249b592f463Schristos.Nm
250b592f463Schristosrunning on the origin host can authenticate to the destination host without
251b592f463Schristosrequiring a password.
252ca32bd8dSchristos.It Fl r
253ca32bd8dSchristosRecursively copy entire directories.
254ca32bd8dSchristosNote that
255ca32bd8dSchristos.Nm
256ca32bd8dSchristosfollows symbolic links encountered in the tree traversal.
257ca32bd8dSchristos.It Fl S Ar program
258ca32bd8dSchristosName of
259ca32bd8dSchristos.Ar program
260ca32bd8dSchristosto use for the encrypted connection.
261ca32bd8dSchristosThe program must understand
262ca32bd8dSchristos.Xr ssh 1
263ca32bd8dSchristosoptions.
264aa36fcacSchristos.It Fl T
265aa36fcacSchristosDisable strict filename checking.
266aa36fcacSchristosBy default when copying files from a remote host to a local directory
267aa36fcacSchristos.Nm
268aa36fcacSchristoschecks that the received filenames match those requested on the command-line
269aa36fcacSchristosto prevent the remote end from sending unexpected or unwanted files.
270aa36fcacSchristosBecause of differences in how various operating systems and shells interpret
271aa36fcacSchristosfilename wildcards, these checks may cause wanted files to be rejected.
272aa36fcacSchristosThis option disables these checks at the expense of fully trusting that
273aa36fcacSchristosthe server will not send unexpected filenames.
274ca32bd8dSchristos.It Fl v
275ca32bd8dSchristosVerbose mode.
276ca32bd8dSchristosCauses
277ca32bd8dSchristos.Nm
278ca32bd8dSchristosand
279ca32bd8dSchristos.Xr ssh 1
280ca32bd8dSchristosto print debugging messages about their progress.
281ca32bd8dSchristosThis is helpful in
282ca32bd8dSchristosdebugging connection, authentication, and configuration problems.
283b1066cf3Schristos.It Fl X Ar sftp_option
284b1066cf3SchristosSpecify an option that controls aspects of SFTP protocol behaviour.
285b1066cf3SchristosThe valid options are:
286b1066cf3Schristos.Bl -tag -width Ds
287b1066cf3Schristos.It Cm nrequests Ns = Ns Ar value
288b1066cf3SchristosControls how many concurrent SFTP read or write requests may be in progress
289b1066cf3Schristosat any point in time during a download or upload.
290b1066cf3SchristosBy default 64 requests may be active concurrently.
291b1066cf3Schristos.It Cm buffer Ns = Ns Ar value
292b1066cf3SchristosControls the maximum buffer size for a single SFTP read/write operation used
293b1066cf3Schristosduring download or upload.
294b1066cf3SchristosBy default a 32KB buffer is used.
295b1066cf3Schristos.El
296ca32bd8dSchristos.El
297185c8f97Schristos.Sh EXIT STATUS
298ca32bd8dSchristos.Ex -std scp
299ca32bd8dSchristos.Sh SEE ALSO
300ca32bd8dSchristos.Xr sftp 1 ,
301ca32bd8dSchristos.Xr ssh 1 ,
302ca32bd8dSchristos.Xr ssh-add 1 ,
303ca32bd8dSchristos.Xr ssh-agent 1 ,
304ca32bd8dSchristos.Xr ssh-keygen 1 ,
305ca32bd8dSchristos.Xr ssh_config 5 ,
306b592f463Schristos.Xr sftp-server 8 ,
307ca32bd8dSchristos.Xr sshd 8
308ca32bd8dSchristos.Sh HISTORY
309ca32bd8dSchristos.Nm
3108a4530f9Schristosis based on the rcp program in
3118a4530f9Schristos.Bx
3128a4530f9Schristossource code from the Regents of the University of California.
313c4271af5Schristos.Pp
314e160b4e8SchristosSince OpenSSH 9.0,
315c4271af5Schristos.Nm
316e160b4e8Schristoshas used the SFTP protocol for transfers by default.
317ca32bd8dSchristos.Sh AUTHORS
318a5684d07Swiz.An Timo Rinne Aq Mt tri@iki.fi
319a5684d07Swiz.An Tatu Ylonen Aq Mt ylo@cs.hut.fi
320f1ad81b8Schristos.Sh CAVEATS
321c4271af5SchristosThe legacy SCP protocol (selected by the
322c4271af5Schristos.Fl O
323c4271af5Schristosflag) requires execution of the remote user's shell to perform
324f1ad81b8Schristos.Xr glob 3
325f1ad81b8Schristospattern matching.
326f1ad81b8SchristosThis requires careful quoting of any characters that have special meaning to
327f1ad81b8Schristosthe remote shell, such as quote characters.
328