Find the answer to your Linux question:
Results 1 to 7 of 7
I have 2 VPS hosting accounts in 2 seperate hosting companies servers and I want to copy the entire public_html from one to the other. Can you help me what ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Aug 2012
    Posts
    54

    Question Command to copy a directory from one server to another


    I have 2 VPS hosting accounts in 2 seperate hosting companies servers and I want to copy the entire public_html from one to the other.

    Can you help me what should i write in ssh to accomplish that?

  2. #2
    Penguin of trust elija's Avatar
    Join Date
    Jul 2004
    Location
    Either at home or at work or down the pub
    Posts
    3,649
    Make sure that you are in the directory to which you want to copy.
    Make sure that port 22 (ssh) is open on the other server.

    Code:
    scp -r user@nnn.nnn.nnn.nnn:/path/to/copy/ .
    user = a user with appropriate permissions on the other server
    nnn.nnn.nnn.nnn = the ip address of the other server
    the path to copy should be fairly self expanitory
    "I used to be with it, then they changed what it was.
    Now what was it isn't it, and what is it is weird and scary to me.
    It'll happen to you too."

    Grandpa Simpson



    The Fifth Continent

  3. #3
    Just Joined!
    Join Date
    Aug 2012
    Posts
    54
    Quote Originally Posted by elija View Post
    Make sure that you are in the directory to which you want to copy.
    Make sure that port 22 (ssh) is open on the other server.

    Code:
    scp -r user@nnn.nnn.nnn.nnn:/path/to/copy/ .
    user = a user with appropriate permissions on the other server
    nnn.nnn.nnn.nnn = the ip address of the other server
    the path to copy should be fairly self expanitory
    So I can just make the user "root"
    But doesnt it need password of anything to login and download all the files from there?
    also can you explain me what is scp and -r ?

  4. $spacer_open
    $spacer_close
  5. #4
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,439
    Yes, it would need a password or key authentication (if in place) for your root account.
    scp is a client tool to copy files via the secure copy protocol.

    You can read about the -r flag in the man page.
    Code:
    man scp
    You must always face the curtain with a bow.

  6. #5
    Just Joined!
    Join Date
    Aug 2012
    Posts
    54
    Quote Originally Posted by Irithori View Post
    Yes, it would need a password or key authentication (if in place) for your root account.
    scp is a client tool to copy files via the secure copy protocol.

    You can read about the -r flag in the man page.
    Code:
    man scp
    So where can i put the password in the command?
    Can you give me the full exact command for the root user?

  7. #6
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,439
    No, because it depends on the ip/hostnames of your remote server as well as the local and remote paths.
    I dont know these, you do.

    elija already showed a skeleton example which you need to fill with parameters.

    scp will ask for the password once a connection has been established.
    You must always face the curtain with a bow.

  8. #7
    Penguin of trust elija's Avatar
    Join Date
    Jul 2004
    Location
    Either at home or at work or down the pub
    Posts
    3,649
    Indeed. Just fill in your details in the boiler plate. Without knowledge of your setup, there is no way to be more specific. The man pages can be a bit dry, but they are probably the best source of information about a program as they tend to be written by the developers; this is also why they can be a bit dry
    "I used to be with it, then they changed what it was.
    Now what was it isn't it, and what is it is weird and scary to me.
    It'll happen to you too."

    Grandpa Simpson



    The Fifth Continent

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •