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...
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:
- Upon the first prompt, enter
123456as the password. - Type
su sshuser. - Type
scp temp@127.0.0.1:data.json /home/sshuser. - Upon the next prompt, type
yesand press “Enter.” - Enter the password set