Moving Files Between Linux Systems With SCP
Moving Files Between Linux Systems With SCPVersion 1.0 This article is about how to move files between servers using the scp (secure copy) command. To show how it works, I will move files from my HDD to a virtual machine running on VirtualBox. There is Linux Mint 11 installed on both drives. This tutorial comes without warranty of any kind. I do not guarantee that this will work for you.
1 Preliminary NoteUsing scp you can not only move files to and between virtual machines like I will do, but move them to any server on the world as well. You only have to know that server's IP adress and the passwords needed to access it.
2 Configuring the Virtual Machine's SystemTo be able to send files to your virtual machines, you first need to have some specific configuration. Open VirtualBox, select the virtual machine you have your target system running on and open Settings > Network. Select the correct Adapter tab (the first one if you haven't done any changes yet) and select Bridged Adapter from the Attached to: dropdown menu. Run your virtual machine afterwards. Once started, open a terminal and enter sudo apt-get install openssh-server ifconfig ifconfig will show you some blocks, one titled eth0. ctest@ctest-System-Product-Name ~ $ ifconfig The IP shown on inet adress: is the one your machine has in your internal network, it will be the one you are going to access the machine under. Go back to the sender system now that you know the receiver's IP. If you have the files to send and the directory to store them on your virtual machine ready, you can proceed by sending the files. Replace the items in [square brackets] with the actual data: scp [path of file to send] root@[receiver's IP]:[target directory] Here is what it looked like if I wanted to send the file FunnyVideo.mp4 in the /home/ctest/Videos directory to the /home/virtualguy/Videos directory of the system with the internal IP 192.168.0.11: scp /home/ctest/Videos/FunnyVideo.mp4 root@192.168.0.11:/home/virtualguy/Videos It may happen that you receive following message having entered the scp command: ctest@ctest-System-Product-Name ~ $ scp /home/ctest/Videos/FunnyVideo.mp4 root@192.168.0.11:/home/virtualguy/Videos This, in most cases, is caused by the fact that the system with the given IP is no longer the same system as it was when you last connected to the same IP, for example, if you hosted a new virtual machine that then took the same IP as the old one. To correct this issue, follow the commands given in the message to remove the offending key. In my case, it is: ssh-keygen -f "/home/ctest/.ssh/known_hosts" -R 192.168.0.11 Make sure to replace the path and the IP with the ones matching your inputs. You can also remove the key manually by opening the known_hosts file with a texteditor and removing the key (as root, of course). If no issue of that sort appears or you have dealt with it, you will be asked if you really want to proceed. Type in yes and hit Enter to confirm. You will then be asked for the receiver's root password. Type it in and hit Enter again. The copied file should then be accessible on the receiver's targeted directory, although you should not have any permissions to write or execute it. If you want to grant you full permissions, use sudo chmod 777 /home/virtualguy/Videos/FunnyVideo.mp4 and make sure to change the path value to the one of your file.
|



Recent comments
50 min 28 sec ago
1 hour 50 min ago
5 hours 37 min ago
6 hours 51 min ago
10 hours 27 min ago
17 hours 42 min ago
1 day 2 hours ago
1 day 4 hours ago
1 day 19 hours ago
1 day 21 hours ago