Transfer Files from one LAMP Machine to Another

I have two LAMP server and I need to transfer a whole directory structure from Machine A to Machine B.

I have telnet root access to both machines.

For most projects I'm working on I just use FTP and download files to my local drive and then upload to the new server via FTP.

But this particular application has nearly 25GB of files to transfer and I would like to simply go straight from server to server.

Is there a simple way to do that from from within the shell access?
Paul KonstanskiProject SpecialistAsked:
Who is Participating?
GaryConnect With a Mentor Commented:
You could always just tar the files, put them in a public directory and wget the file on the other server.
Kent WConnect With a Mentor Sr. Network / Systems AdminCommented:
You most likely have ssh, not telnet access.  

If you are transferring files, I would recommend rsync.  It pipes through ssh nicely, so all you need to do is something like

rsync -avz -e ssh /var/www/html/

For this example, I'm assuming you want to transfer /var/www/html/ to the new machine.
-e ssh tells rsync to pipe through ssh (what you are probably referring to as "telnet").

All you need to do upon running the command is give the root pass / user when prompted.
"" is your receiving server.

Do NOT try to transfer / (your whole directory structure). Just transfer the files / config files you actually need to migrate.  If you transfer things like /dev /proc, etc. you will hose the receiving box.
Paul KonstanskiProject SpecialistAuthor Commented:
I just realized that I don't have root SSH access on the receiving machine, so I'll have to do the tar option.

Can you give me a sample of how those commands would work?

I'm only moving over a bunch of audio files. It could be as much as 25GB and 1000 files. Will that work via TAR?
Never miss a deadline with

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Depending the server setup you may be able to do a server to server transfer in your FTP program

tar just packs the files into one file that you can then untar when transferred - easier than copying each file individually.

tar -zcvf target_name.tar.gz folder_to_tar
omarfaridConnect With a Mentor Commented:
is ftp open between the two servers?

you can always schedule crontab job to tar the files and then transfer to the other server via ftp and on the remote server untar files.

if you could have ssh between the two systems allowed then you could schedule scp via crontab to copy folders between the two.
Kent WSr. Network / Systems AdminCommented:
Also, if you have a web server running on the first machine, you can place the .tar in a web directory and use wget from the new machine to download.


It will be downloaded to the directory from which you issue the command.
You just repeated exactly what I said.
Kent WSr. Network / Systems AdminCommented:
Oops.  Didn't see that Gary, my apologies.

Oh, I see, I saw his request for how go use wget.  That's more of the lines of what I was answering.  The actual command, which OP asked.  I think after that was where you addressed the ftp how-to, and actual unzipping.
Gerwin Jansen, EE MVEConnect With a Mentor Topic Advisor Commented:
You would not need root access for copying files from one system to another, just a user that can logon (ssh) that has write access to the destination folder.

You can use tar on one server to create the archive directly to stdout, then send that to tar on the other machine to write output to the destination.

Like this:

(on source system)

tar cfz - /source/path | ssh user@destinationhost tar xfz - -C /destination

Open in new window

In the example above path is your source folder with the audio files, the command above will create that same folder as a subfolder of /destination. z option is compressing data as it is being transferred.
Paul KonstanskiProject SpecialistAuthor Commented:
Good answer. Hard to pick any one as best since they all add to it.  Thanks.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.