Moving Files Between Linux Systems With SCP

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.

1 Preliminary Note
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 System
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

sudo apt-get install openssh-server
ifconfig

ifconfig will show

ctest@ctest-System-Product-Name ~ $ ifconfig
eth0      Link encap:Ethernet  HWaddr f4:6d:04:94:8f:17
          inet addr:192.168.0.11  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::f66d:4ff:fe94:8f17/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:234392 errors:0 dropped:0 overruns:0 frame:0
          TX packets:128835 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:332109021 (332.1 MB)  TX bytes:11758082 (11.7 MB)
          Interrupt:43 Base address:0x6000

<span id="more-275"></span>

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:39 errors:0 dropped:0 overruns:0 frame:0
          TX packets:39 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:2424 (2.4 KB)  TX bytes:2424 (2.4 KB)

ctest@ctest-System-Product-Name ~ $

Replace the items in [square brackets]

scp [path of file to send] root@[receiver's IP]:[target directory]

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

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
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
4e:c0:50:9a:cf:b6:bc:45:ed:9b:54:97:d8:11:21:a8.
Please contact your system administrator.
Add correct host key in /home/ctest/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /home/ctest/.ssh/known_hosts:4
  remove with: ssh-keygen -f "/home/ctest/.ssh/known_hosts" -R 192.168.0.11
ECDSA host key for 192.168.0.11 has changed and you have requested strict checking.
Host key verification failed.
lost connection
ctest@ctest-System-Product-Name ~ $

the commands given in the message to remove the offending key

ssh-keygen -f "/home/ctest/.ssh/known_hosts" -R 192.168.0.11

to grant you full permissions

sudo chmod 777 /home/virtualguy/Videos/FunnyVideo.mp4