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