Search⌘ K
AI Features

Transferring Files with scp

Understand how to transfer files using the scp command in Linux. Learn to copy single files and entire directories securely from your local machine to a remote server and vice versa. Discover methods to avoid common pitfalls when overwriting remote directories and verify successful transfers.

We'll cover the following...

The scp command

We can copy the data.json file we created previously from the server to the machine using the scp command. We specify the source path first, followed by the destination path. The source is on the remote server, so we specify the username and server address, followed by the path to the file on the server, using a colon to separate the host from the remote path:

$ scp {username}@{ip}:{source} {destination}

Follow these steps:

  1. Upon the first prompt, enter 123456 as the password.
  2. Type su sshuser.
  3. Type scp temp@127.0.0.1:data.json /home/sshuser.
  4. Upon the next prompt, type yes and press “Enter.”
  5. Enter the password set
...