Site Fuse! programming, design, hosting, promotion and advertising tips for webmasters
Design    Programming    Hosting    Classifieds

Server to server transfer using ssh and wget


Important: The following is a text only archive!
For full features; Go to Server to server transfer using ssh and wget

posted by 2Guns What I do when I upgrade/switch servers(full site transfer, files along with the server logs and database backups... etc.) or simply want to transfer a file from one server to another is to use ssh and a cute little software called "wget".

Login through ssh or telnet to the server with the files you want to transfer.

cd to the directory that contains the file(s)

cd /home/domain.com/htdocs
Once you're inside the directory that contains the file(s) tar them up. This will not only help you with the file size, it will also preserve your file/directory permissions.

tar -cvf filestomove.tar ./
Once that's finished, go to the server that you want to move files to and login through ssh or telnet.

cd to the directory that you want to place the file(s)

cd /home/homepage.com/htdocs
Get the file from the other server using wget

wget -c http://www.domain.com/filestomove.tar
Un-tar the file(s)

tar -xvf filestomove.tar

At this point I would check to make sure the correct owner and group are on your files you just unpacked. You can check to see what they are by typing:

ls -la
If the owner or group is wrong you can type this to fix all the files:

chown -R owner.group ./
owner.group should be replaced with the owner name you want and the group name you want. This will recursively go through all your files and directories and changed them to the correct owner and group.