2.5 Secure Copy
Sometimes it’s needed to copy files from one Virtual Machine to another.
This is done with the scp command which means Secure Copy this uses the SSH protocol to copy files between machines.
become root
Secure Copy to your machine
We are going to copy the file veryimportantfile from the Hypervizor your student VM, using the scp command, it looks nearly the same as the ssh command.
become root
You need to know exactly where the file is, and we know that it is at /home/greater/veryimportantfile on the Hypervizor.
scp [user]@[server]:[/file/location] [/where/you/want/the/file]
To accomplish the copy of the veryimportantfile we can use the following command:
scp /home/greater/veryimportantfile greater@rhcsa:/home/greater/veryimportantfile
This will attempt to login with the user greater on the rhcsa server to copy the veryimportantfile to it.
It will ask if you want to register the key type: yes
It will ask for a password, this is: greater
Now we can check what is in the veryimportantfile with the cat command this shows what is in a test file just directly in the terminal.
cat /home/greater/veryimportantfile
You should get a important message.