SCP is one of the most common tool for transferring files between remote and local machines. It can be also used for moving files or directories within the same machine. It uses a minimalistic approach, and it’s easy to use it. Let’s see how to install SCP on Amazon Linux 2.
Prerequisites
- Amazon Linux 2
- sudo privileges
Install SCP on Amazon Linux 2
Step 1. Update the yum
packages.
sudo yum update
Step 2. Install SCP as a part of OpenSSH server and the OpenSSH client packages.
sudo yum install openssh-clients openssh
Step 3. Copy a local file to a remote machine.
scp backup.zip username@ip-address:/home/devcoops
To copy a directory from local to remote machine, run:
scp -r /home/files username@ip-address:/home/devcoops
Step 4. Copy a remote file to a local machine.
scp username@ip-address:/home/backup.zip /home/devcoops
Step 5. Copy a file between two remote machines.
scp username1@ip1:/home/files/db.sql username2@ip2:/home/devcoops
Conclusion
Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.