


Let's have a look at transferring a file between two remote hosts.

But, when complete, you should have a new file in the folder you specified. This works essentially in the same way, except that the remote user, host, and path are now specified before the local path.Ī prompt will still be displayed for the password belonging to the remote host's user account. $ scp :path/to/remote/file.ext path/to/ local/file.ext In a very similar fashion, we can copy a file from a remote computer to our local machine: Transferring a Remote File to a Local Destination Now that we know how to transfer a remote file to our local machine, let's discuss the reverse scenario - transferring a file from a remote host to the local host. If you can't use your credentials to log in remotely with ssh, then those credentials will not work when using scp. This user account must have access to the remote path specified in the command. Once the password is entered, the file will be copied. We then specify where we want to copy the file to on the remote machine after the colon ( :).Īfter running this command, a prompt will display for the password corresponding to the remote host's user account: $ 's password:.The remote-host supplied is the domain name or the IP address of the remote machine we are trying to connect to.The username has to belong to a user of the remote machine. The user supplied in the command is the username.This command will copy the local file file.ext to the specified path (after the colon) on the remote-host. The basic syntax for the SCP command is as follows.$ scp path/to/ local/file.ext :path/to/remote/file.ext Whatever the reason, the SCP command has your back. Perhaps for backup purposes, replicate configuration files, or simply want to have a copy of the files. There can be many reasons you’d want to copy files from one system to another. Related: Using Pageant Putty Agent to Unleash Your SSH Key Use Copying a File using the SCP Command This tutorial assumes that you have already opened an SSH session and logged on to both computers.Related: How To Set Up the UFW Firewall on Linux If there’s a firewall on each or between the two computers, make sure that port 22 is open.This tutorial will be using Ubuntu 20.04 computers, as listed in the table below. You’ll need two Linux computers to act as the copy source and the copy destination on the same or different networks.If you’d like to follow along, be sure you have the following requirements. This tutorial will be a hands-on demonstration. Ready? Read on to take your file transfers to the next level! Prerequisites This tutorial will show you SCP command usage examples, which could help you become a confident SCP user. If you’re looking for an awesome guide to using the SCP command, look no further. Not seeing the video? Make sure your ad blocker is disabled.
