Server to Server transfer using ssh

  • atulb
  • Born
  • Born
  • No Avatar
  • Joined: Dec 09, 2003
  • Posts: 1
  • Status: Offline

Post December 9th, 2003, 7:47 pm

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.

thanks in advance
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post December 9th, 2003, 7:47 pm

  • GQuest
  • Born
  • Born
  • User avatar
  • Joined: Dec 19, 2003
  • Posts: 3
  • Status: Offline

Post December 19th, 2003, 5:42 pm

- tar your files
- put them in a webdirectory
- lynx em from the other server
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Joined: Dec 20, 2002
  • Posts: 8926
  • Loc: Seattle, WA & Phoenix, AZ
  • Status: Offline

Post December 20th, 2003, 7:19 pm

What I usually do is somewhat exactly what GQuest said. I would definetely tar them up because your file permissions should be preserved making it less work for your to prepare you site on the new server. First I would login through ssh or telnet to the server with the website. Here are the commands I would type:

cd /home/somepath/to/yourwebsite/public_html
tar -cvf sitepack.tar ./

Once that is finished I would goto your new server and login through telnet and ssh. Here I would type:

cd /home/somepath/to/yourwebsite/public_html
wget yourdomain.com/sitepack.tar
tar -xvf sitepack.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.
Ozzu Hosting - Want your website on a fast server like Ozzu?
  • zynch
  • Born
  • Born
  • No Avatar
  • Joined: Feb 21, 2004
  • Posts: 1
  • Loc: philippines
  • Status: Offline

Post February 22nd, 2004, 4:07 am

I just successfully used that but accidentally the tar file was renamed to public_html instead of tar.tar lol, can you help me on how to rename this file to tar.tar ? thanks in advance :roll:
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Joined: Dec 20, 2002
  • Posts: 8926
  • Loc: Seattle, WA & Phoenix, AZ
  • Status: Offline

Post February 22nd, 2004, 4:45 am

If you are sure public_html is not a directory and actually a file, you can rename that by typing this in ssh:

mv public_html tar.tar

That will rename public_html to tar.tar
Ozzu Hosting - Want your website on a fast server like Ozzu?
  • rjmthezonenet
  • Expert
  • Expert
  • User avatar
  • Joined: Jan 14, 2004
  • Posts: 526
  • Loc: St. John's, Newfoundland, Canada
  • Status: Offline

Post February 22nd, 2004, 4:30 pm

Since you already suggested using SSH, then rsync may be for you. This utility is awesome as providing a secure method to transfer files in bulk and is the tool for keeping two sets of files in sync.

As a bonus, you can run it as a background task on the server. That means you won't have to configure inetd or xinetd. Assuming you have working SSH on the client and server:

(server)
tar -zxvf rsync
cd rsync
./configure
make
install
/usr/bin/rsync --daemon $

(client)
tar -zxvf rsync
cd rsync
./configure
make
install
rsync -rvz server:/dir/dir/dir /backup/dir

The best part of rsync is that if some files change in the server /dir/dir/dir directory, the next transfer will only be the updates. This equals speed improvements a few hundred times faster!

I'm not sure about server to server transfers (maybe fsp). Maybe daemonguy has a suggestion...
  • Daemonguy
  • Moderator
  • Web Master
  • User avatar
  • Joined: Jan 23, 2004
  • Posts: 2673
  • Loc: Somewhere outside the box in Sarasota, FL.
  • Status: Offline

Post February 24th, 2004, 7:02 am

Good lord! wget?

If they have ssh enabled, than I am comfortable saying that scp is functioning. SCP is secure copy that transfers files much like ftp though over SSH tunneling.

tar up the files as mentioned -- preserve integrity of course (attime preserve and preserve permissions).

Either go from original host to new host or vice versa.

scp localfile myname@<newhost>:/<path to owned directory>
or
go to the new host and do it the other way.
scp username@<oldhost>:<path to file> ./

Cheers.
"It's always a long day, 86,400 won't fit into a short."
  • rjmthezonenet
  • Expert
  • Expert
  • User avatar
  • Joined: Jan 14, 2004
  • Posts: 526
  • Loc: St. John's, Newfoundland, Canada
  • Status: Offline

Post February 24th, 2004, 1:02 pm

Secure Copy Man Page

OpenBSD Reference Manual SCP(1) wrote:
Any file name may contain a host and user specification to indicate that the file is to be copied to/from that host. Copies between two remote hosts are permitted.

-p Preserves modification times, access times, and modes from the original file.

-r Recursively copy entire directories.


Abbreviated Usage wrote:
scp -rp [[user@]host1:]file1 [...] [[user@]host2:]file2


You could go from host to host (by passing your computer), recuse subdirectories and preserve modification times, access times, and modes from the original file with this command:

scp -rp username@host1:/www/ username@host2.com:/www

Ownership of files was not identified as preserved according to the scp man page. This is be a problem if file ownership should not be your username:groupname on the new host. You should test -p and verify (please post your result here if you do).

You can either:
a) Use chown to change all these files (it can recurse subdirectories), or
b) tar the files and extract them on the destination server.

Since scp does not compress on-the-fly, you will be preserving bandwidth by using a compression (i.e. files.tar.gz).

Daemonguy wrote:
Good lord! wget?


There more than one way to do things. scp is a great utility and I'm glad to have learned about it (thats the great thing about discussion forums).

Every tool has its strength and weakness. For example, scp can preserve file properties and rsync can compress on-the-fly. Other utilities are beneficial because of familiarity: ftp and wget, for example.

Your suggestions on this discussion forum are always very helpful and I look forward to your perspective. However, it shouldn't come at the price of discouraging others from offering their help.
  • Daemonguy
  • Moderator
  • Web Master
  • User avatar
  • Joined: Jan 23, 2004
  • Posts: 2673
  • Loc: Somewhere outside the box in Sarasota, FL.
  • Status: Offline

Post February 24th, 2004, 1:28 pm

rjmthezonenet wrote:


Daemonguy wrote:
Good lord! wget?


There more than one way to do things. scp is a great utility and I'm glad to have learned about it (thats the great thing about discussion forums).

Every tool has its strength and weakness. For example, scp can preserve file properties and rsync can compress on-the-fly. Other utilities are beneficial because of familiarity: ftp and wget, for example.

Your suggestions on this discussion forum are always very helpful and I look forward to your perspective. However, it shouldn't come at the price of discouraging others from offering their help.


Pardon my surprise; for that is the sole reason for my response, such as it was. I also did not realize I was being "discouraging" -- I thought I was being helpful, go figure.
I doubt rsync would be useful, unless he could set one machine up as the rsync daemon server, and even then it's more useful for diff's -- and quite a bit more work for a single instance transfer of data.
In any case, I shall endeavor to curb my responses henceforth.

Cheers.
"It's always a long day, 86,400 won't fit into a short."
  • rjmthezonenet
  • Expert
  • Expert
  • User avatar
  • Joined: Jan 14, 2004
  • Posts: 526
  • Loc: St. John's, Newfoundland, Canada
  • Status: Offline

Post February 24th, 2004, 1:32 pm

I found his in the help documentation for CuteFTP

Quote:
CuteFTP is capable of transferring files from one remote server to another. Some servers do not allow this style of transfer; if you’re having difficulty getting this feature to function properly, please contact the administrator of the FTP site to see if Site-to-Site Transfers are supported.

To perform a Site-to-Site transfer:

1. Connect to the first remote site and choose Window > New CuteFTP Window to launch another instance of CuteFTP.
2. Connect to the second site in the new window.
3. Drag and drop the desired file from one window to the other.


Few FTP clients support site-to-site tranfers (FXP) and both servers must allow it. gFTP is another client that I know of that does support this.
  • Axe
  • Genius
  • Genius
  • User avatar
  • Joined: Jan 07, 2004
  • Posts: 5744
  • Loc: Sub-level 28
  • Status: Offline

Post February 24th, 2004, 1:49 pm

FlashFXP also does this.. I've been using FlashFXP for years and it's great, but like the quote, not all servers allow FXP transfers, and I believe the ability is disabled by most Linux distros by default - allowing FXP can potentially open up one or two DoS problems.
  • rjmthezonenet
  • Expert
  • Expert
  • User avatar
  • Joined: Jan 14, 2004
  • Posts: 526
  • Loc: St. John's, Newfoundland, Canada
  • Status: Offline

Post February 24th, 2004, 2:58 pm

Axe wrote:
...he ability is disabled by most Linux distros by default...


Apparently ipchains dropped support. Sorry, I can't remember specifics.
  • phpSelectah
  • Student
  • Student
  • User avatar
  • Joined: Feb 11, 2004
  • Posts: 97
  • Status: Offline

Post February 24th, 2004, 3:01 pm

scp, ffs. :D

unless your are going to do this on a daily basis, or some other high frequency, then I would recommend rsync.
  • Axe
  • Genius
  • Genius
  • User avatar
  • Joined: Jan 07, 2004
  • Posts: 5744
  • Loc: Sub-level 28
  • Status: Offline

Post February 24th, 2004, 3:21 pm

rjmthezonenet wrote:
Apparently ipchains dropped support. Sorry, I can't remember specifics.


As well as that, there's a setting in most FTPd configs that has to be changed to allow it - even if IPChains isn't blocking anything...

I do remember when I was setting up wuftpd for shifting files across my LAN from one box to several others, I had to modify the configs to allow FXP support. I just told it what to shift where from my windows machine with FlashFXP.
  • fehers
  • Born
  • Born
  • No Avatar
  • Joined: Oct 22, 2004
  • Posts: 1
  • Loc: Serbia and Montenegro
  • Status: Offline

Post October 22nd, 2004, 11:42 am

Hello,

I read all the posts on this page and since I haven't found the answer to my question I post it here. What interests me is how can I transfer the file http://us2.php.net/distributions/php-5.0.2.tar.bz2 to a ftp server.

I know how can I transfer it using wget on a same server wget is installed on and I know how can a file be copyed and/or moved from one ftp server to other ftp server. For information purposes I do this using Net2Ftp. A cool server sided php script that can do all the move-copy stuff but not form an "ordinary" url address as above. Anybody know how can I do it using ssh or some other software? To simplify it... Remote transfer a file from one server to another...
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post October 22nd, 2004, 11:42 am

Post Information

  • Total Posts in this topic: 28 posts
  • Users browsing this forum: No registered users and 112 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.