Security analysts constantly need to move files around; be it logs, ISO’s or VM’s, in Windows this is pretty easy. But how about in Linux? There are many way’s do move files between Linux machines and today we will discuss one of the most popular. SCP offers speed and versatility when it comes to moving files and allows analysts to seamlessly transfer files to and from a remote machine. Let’s see if we can get it done in two minutes!
What is SCP?
Secure Copy Protocol (SCP) is a command line utility in Linux that allows users to transfer files to and from other machines securely over the Secure Shell protocol (SSH). SSH provides the security by encrypting the session in order to ensure the communications confidentiality. SSH and SCP are installed by default in all flavors (distributions) on Linux and Unix so finding it should not be a problem. To see the documentation just type:
How to copy files to a remote system
Probably the most useful application for secure copy is just simply moving a file from the host you are on to a remote host; i.e. moving a log file to another host for analysis or archiving. SCP allows you to do this effortlessly by just entering the following:
scp eda-test.sh firstname.lastname@example.org:remote-test/
This will copy the eda-test.sh file to the remote system 220.127.116.11. To recursively move a directory and all sub directories and files just type:
scp -r geoipdata/ email@example.com:remote-test/
This will result in the entire geoipdata directory and all of it’s sub directories and files to be copied to the remote host.
How to copy files from a remote system
Moving files from a remote host is accomplished much in the same way, just a slight syntax modification. This can be very useful if you need to move tools over to a system or get log files from it. To move a single file from a remote system back to your host, just type this:
scp firstname.lastname@example.org:/home/eda/remote-test/remote.zip /home/eda/test/
The remote.zip file will be copied from the remote host to the local host. Moving an entire directory recursively is similar accomplished by:
scp -r email@example.com:/home/eda/remote-test/blog-posts /home/eda/test/
There are many other options for SCP so check out the manpage. I hope you found this helpful, if so please give it a thumbs up and share it. Also if you liked the video and want to see more content like this give it a thumbs up and subscribe.