To copy a file from a source (such as a network server) to a destination (such as a flash disk), use
copy
command in XR EXEC mode.
copy
source
{
location
node-id
destination
location
{
node-id
| all
}
|
running-config
[atomic]
}
Syntax Description
|
source
|
Filename including the directory path or network location of the file. The possible sources are:
directory-path
—Directory path of the file from which the file is copied.
access-list
{
ipv4
|
ipv6
}—Copies an access list (EXEC mode only).
config:
—Copies from disk0: file system.
disk0:
—Copies from disk0: file system.
ftp:
—Copies from an FTP network server. The syntax is
ftp:[[[//username [:password]@] location]/directory]/filename.
harddisk:
—Copies from the hard disk drive file system (if present).
http:
—Copies from one webserver to another over a network. The syntax is
http://username: password@ ip-address: port/ directory-path
https:
—Copies from the https: file system. The syntax is
https://username: password@ ip-address: port/ directory-path
sftp:
—Copies from an SFTP network server. The syntax is
sftp:[[[//username [:password]@] location]/directory]/filename.
scp:
—Copies from an SCP network server. The syntax is
scp:[[[//username [:password]@] location]/directory]/filename.
prefix-list {ipv4 | ipv6} —Copies from a prefix list (EXEC mode only).
rootfs:
—Copies from the rootfs: file system.
running-config
—Copies from the current system configuration.
tftp:
—Copies from a TFTP network server. The syntax is
tftp:[[//location]/directory]/filename
xml-schema
—Copies the XML schema files as a tar ball file (.tar.gz) [EXEC mode only].
|
|
destination
|
Filename including the directory path or network location of the file.
|
|
location
node-id
|
Specifies a node. The
node-id
argument is expressed in the rack/ slot notation.
|
|
location
all
|
Copies to all nodes.
|
|
running-config
|
Applies the source configuration file to the running configuration of the system.
|
|
atomic
|
(Optional) Applies the changes to the running configuration only if there are no errors
|
Command Modes
XR EXEC mode
Command History
|
Release
|
Modification
|
|
Release 25.4.1
|
The ftp,tftp, and rcp keywords are deprecated.
|
|
Release 7.10.1
|
This command was modified to support public key authentication.
|
|
Release 7.9.1
|
This command was modified to support SFTP and SCP options.
|
| Release 7.0.12 |
This command was introduced.
|
Invalid Combinations of Source and Destination
Some combinations of source and destination are invalid. Specifically, you cannot copy the following:
-
From a running configuration to a running configuration
-
From a network device to a network device (for example,
copy
ftp:
rcp:
)
Using TFTP
TFTP is a simplified version of FTP that allows files to be transferred from one computer to another over a network, usually without
the use of client authentication (for example, username and password).
The syntax is as follows:
copy
tftp://hostname /ipaddress/directory-path
pie name
target-device [location {node-id | all}]
Example:
Router# copy tftp://1.1.1.1/images/software.pie disk1:

Note
|
Some Cisco IOS XR images may be larger than 32 MB, and the TFTP services provided by some vendors may not support a file this
large. If you do not have access to a TFTP server that supports files larger than 32 MB, download the software image using
FTP or rcp as described in the following sections.
|
Using FTP
FTP servers require a username and password for each client request. Cisco IOS XR software sends the first valid username in the following list:
-
The username and password specified in the
copy
command, if a username is specified.
The syntax is as follows:
copy ftp://
username
:
password
@
hostname or ipaddress/directory-path/pie-name
target-device [location {node-id | all}]
Example:
Router# copy ftp://john:secret@10.1.1.1/images/software.pie disk1:
-
An “anonymous” username and password. The anonymous password is “root@ip address,” where “ip address” is the IP address of
the local networking device.
-
A password “username@iosname.domain” formed by the networking device. The variable “username” is the username associated with
the current session, “iosname” is the configured hostname, and “domain” is the domain of the networking device.
The username and password must be associated with an account on the FTP server. If you are writing to the network server,
the FTP server must be properly configured to accept the FTP write request from the user on the networking device.
If the network server has a directory structure, the configuration file or image is written to or copied from the directory
associated with the username on the network server. For example, if the system image resides in the home directory of a user
on the network server, specify the name of that user as the remote username.
Refer to the documentation for your FTP server for more details.
Using rcp
The rcp protocol requires a username upon each request. When you copy a configuration file or image between the networking
device and an rcp server, the Cisco IOS XR software sends the first valid username in the following list:
-
The remote username specified in the
copy
command, if one is specified.
-
The username set by the
rcp
client
username
command, if the command is configured.
-
The networking device hostname.
For the rcp copy request to process successfully, an account must be defined on the network server for the remote username.
If the network administrator of the destination server did not establish an account for the remote username, this command
does not run successfully. If the network server has a directory structure, the configuration file or image is written to
or copied from the directory associated with the remote username on the network server. For example, if the system image resides
in the home directory of a user on the network server, specify the name of that user as the remote username.
If you are writing to the network server, the rcp server must be properly configured to accept the rcp write request from
the user on the networking device. For UNIX systems, add an entry to the .rhosts file for the remote user on the rcp server.
Suppose the networking device contains the following configuration lines:
hostname Rtr1
ip rcp remote-username User0
If the IP address of the networking device translates to company.com, then the .rhosts file for User0 on the rcp server should
contain the following line:
company.com Rtr1
See the documentation for your rcp server for more details.
If you are using a personal computer as a file server, the computer must support remote shell (rsh) protocol.

Note
|
Starting with Cisco IOS XR Software Release 25.4.1, do not use the FTP, TFTP and RCP protocols for, as these are unsecure
and deprecated. Instead, use SFTP (Secure File Transfer Protocol) or SCP (Secure Copy Protocol) for improved security, as
they provide encrypted communication.
Syslog warnings will be generated if the following XR configuration and EXEC commands are used:
XR Configuration Commands:
-
ftp client
-
ip ftp
-
tftp client
-
ip tftp
EXEC Commands:
-
install add source ftp
-
install add source tftp
-
install source tftp
-
install source ftp
-
install replace tftp
-
install replace ftp
-
copy using ftp
-
copy using tftp
-
load ftp
-
load tftp
For XR configuration commands, periodic syslog warnings will be generated once every 30 days as long as FTP or TFTP configured.
For EXEC commands, syslog warnings will be displayed each time these commands are executed.
|
Using xml-schema
Use the
xml-schema
keyword to obtain the most up-to-date XML schemas (.xsd files) from the router. Using this keyword is useful to prevent the
use of outdated schemas in the event that router software updates include schema updates. The tar ball file includes all active
schema files. It does not include schemas that are activated by specific package installation envelopes (PIEs) if those PIEs
are not installed and activated on the router.
Using HTTP(s)
HTTP(s) allows files to be transferred from one webserver to another over a network. The user authentication depends on the webserver
configuration. The following copy operations are supported:
-
Copy a file from webserver to device via HTTP
-
Copy a file from webserver to device via HTTPS
-
Copy a file from device to webserver via HTTP

Note
|
Copying a file from device to webserver via HTTP is not supported.
Copying a file from sys-admin via HTTP(s) is not supported.
|
The syntax is as follows:
copyhttps://username: password@ ip-address: port
target-device [location {node-id | all}]
Example:
The following example shows how to copy a file from http server, where user credentials are not required, and server listens
to the default port.
Router# copy http://1.1.1.1/images/software.pie disk1:
The following example shows how to copy a file from http server, where user credentials are required, and server listens to
the default port.
Router# copy http://user:cisco@1.1.1.1/images/software.pie disk1:
UserID: user
Password: cisco
The following example shows how to copy a file from http server, where user credentials are required, and server listens to
a specific port.
Router# copy http://user:cisco@1.1.1.1:45/images/software.pie disk1:
UserID: user
Password: cisco
Specific listen port: 45
Copying to the Running Configuration
When you use the
copy
command to copy a configuration file to the
running-config
destination, the configuration in the file is applied to the running configuration of the system. This is a configuration
operation. By default, the copy is carried out in a best-effort manner. This means that if some configuration lines from the
file cannot be applied, the remaining configuration is still integrated into the system. In this case, a partial configuration
is committed. When the
atomic
keyword is used, partial configurations are not committed. This means that even if one error occurs in the parsing or committing
phase, no changes are made to the system. To view any errors when applying the configuration, use the
show
configuration
failed
command.
Task ID
|
Task ID
|
Operations
|
|
filesystem
|
execute
|
Examples
The following example shows how to copy a file from a FTP server to disk1:
Router#copy ftp://john:secret@10.1.1.1/images/comp-cisco8k-full.pie disk1:
The following example shows how to copy a file from an rcp server to disk1:
Router#copy rcp://john@10.1.1.1/images/comp-cisco8k-full.pie disk1:
The following example shows how to copy a configuration file to running-config destination:
Router#copy running-config disk0:/running-config.txt
Thu Apr 20 15:53:49.116 UTC
Destination file name (control-c to cancel): [/disk0:/running-config.txt]?
Building configuration.
188 lines built in 1 second
[OK]
Examples
The following example shows how to copy a file from a SCP and SFTP server using public key authentication:
Router#copy running-config scp://root@192.0.4.2//var/opt/run_conf_scp.txt
Router#copy running-config sftp://root@192.0.4.2//var/opt/run_conf_sftp.txt