Server to Server transfer using ssh

They have: 3 posts

Joined: Dec 2003

Hey, i am moving my exiting website to another server, and i have shell access to both servers. How can transfer files from existing server to the new servers.

They have: 5,633 posts

Joined: Jan 1970

Do you have a control panel?
If you have cpanel, you can get your host to do the transfer through WHM (in-built function).

If not, you can tar the files in the source folder, use
"scp " where destination is in the form [email protected]:/destinationfolder
try the man page for scp to know more.

They have: 3 posts

Joined: Dec 2003

Yea but how would you transfer whole folders instead of individual files.

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Do you have CPanel?

Because you can backup your server to remote locations using CPanel, including another server. It will gzip the files (all of them) and then you can unzip them at the new location.

druagord's picture

He has: 335 posts

Joined: May 2003

Or like headbuilder said tar your folder and transfer it using scp

They have: 3 posts

Joined: Dec 2003

I do havve cpnel but i dont know how to transfer using that. how do you make a tarball??

mairving's picture

They have: 2,256 posts

Joined: Feb 2001

Usually what I do is to:
tar and gzip everything tar cvf - directory/ | gzip > directory.tar.gz
ftp to the site at the SSH shell prompt
ftp sitename or IP address
send the files mput directory.tar.gz
close ftp bye
SSH to the other server and uncompress them:
tar -xvzf directory.tar.gz

I really don't like using CPanel for transfers as it has a tendency to reset permissions.

Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.