Ubuntu Machine 1 -- A live Ubuntu instance, temporary. Ubuntu Machine 2 -- The target machine with an external hard drive connected.

I want to copy files from Ubuntu Machine 1 to that external hard drive on Ubuntu Machine 2. How do I do that?

I've got the ip addresses of both machines.

Ubuntu Machine 1 is in a VM environment. I made some test images there. I want to copy them to a physical external drive so I can actually apply the image on a physical test machine. I've got the image file on that first machine, on a second hard drive, formatted ext4. Windows can't read that. I do have a separate Ubuntu computer (Ubuntu Machine 2 in this scenario) set up that can write to the external drive. I need to get that image from the Ubuntu VM to the physical Ubuntu computer's external drive.

Got something copying. I used this site to enable ssh on the target computer: https://vikashazrati.wordpress.com/2008/02/03/quicktip-transferring-files-between-two-ubuntu-systems/

Pinging either way already worked. I had to install and enable ssh on that target computer. ssh'ing from the live ubuntu machine to the target computer worked. I had to chown on the second hard drive on the live ubuntu machine, using sudo too:

sudo chown -R ubuntu: /media/ubuntu/long-number-list

Otherwise I got permissions errors.

scp did need -r since it's a directory I guess. Otherwise I got an error about "not a regular file." I didn't try to get it on the physical external drive, just to the Desktop on the target machine, although it wouldn't be much more work to get there now.

Looks like it's copying the whole folder/directory over, not copying the contents with the containing folder. Afterwards I can turn ssh off on the target machine to keep it secure.

  • scp (secure-copy; an encrypted version of rcp which is remote-copy) the files there. cp will only copy on a mounted drive; scp doesn't have this limit and is used to copy from one machine to another machine (with data encrypted on route). you'll have to enable 'ssh' login on machine 2 if its not already enabled, as scp uses ssh to achieve the copy. scp -r path/filespec* machine2-ip:/dest-path/ – guiverc Dec 20 '17 at 22:36
  • you won't need the -r (recursive) .. sorry my fingers just typed it out of habit – guiverc Dec 20 '17 at 22:46

To copy between linux systems connected by IP, I recommend rsync. Type $ man rsync to see the documentation. I usually recommend zipping your files before copying across IP.

$ rsync [options] src destination


$ rsync file.zip username@ip:/home/ubuntu/Documents

The above command would copy file.zip to Documents directory of your remote.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.