The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Backup - Multiple Destinations

Discussion in 'Data Protection' started by fujipadam, Oct 15, 2010.

  1. fujipadam

    fujipadam Member

    Joined:
    Jun 25, 2009
    Messages:
    23
    Likes Received:
    0
    Trophy Points:
    1
    Hi,

    I need to backup my server in 2 different places

    1) daily backup to a local drive
    2) weekly backup to a remote FTP location

    But I am not able to see a place in WHM where both can be added. Any help is greatly appreciated

    Thanks,
    Fuji
     
  2. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,453
    Likes Received:
    195
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    There are no default tools available in your cPanel to handle this sort of thing.
     
  3. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Hello Fuji,

    To accomplish what you want, you'd have to backup to a local drive daily in WHM > Backup > Configure Backups area.

    After getting the daily backups, you'd then have to add a cron script that would ftp or a cron command to scp the contents of the backups weekly to your remote FTP machine. Since daily backups also creates a weekly folder, you could simply copy that weekly folder.

    That is the only way I really see it working the way you are wanting it to work.

    Thanks.
     
  4. Data 1

    Data 1 Well-Known Member

    Joined:
    May 25, 2008
    Messages:
    113
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Columbus Ohio
    cPanel Access Level:
    DataCenter Provider
    Hi,

    I want to do this exact thing also executing a script with cron to do the scp transfer. Not quite sure how to set up the authentication though. I don't think this is a thread hijack because my need is identical to the original poster and I bet if him and myself are looking for this many others are and could benefit from a semi canned solution.
     
  5. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    You could set up the authentication by simply adding SSH keys to the two machines. On the cPanel machine, go to WHM > Manage SSH Keys and click "Generate a New Key" option and keep the defaults. The new key will be called id_dsa. Back in Manage SSH Keys area, click on "View/Download Key" and copy the public key there. Go to the machine where you will be scping the files and if it has WHM, go to Manage SSH Keys area again, select Import Key, paste the key into the public box and save it. After saving it, select "Manage Authorization" back in the main Manage SSH keys area and authorize the key.

    If you do not have cPanel on the machine you will be scping the file, then ssh to the machine and cd to /root/.ssh then save the key in authorized_keys file from the previously saved contents. Also, place a copy of the public key as root@fullhostname with the contents copied previously.

    Test it is working by going back to the cPanel server and trying to ssh to the one you'll be using to scp the files. If it doesn't ask for a password this time, it's working.

    Now, the point of having SSH keys would be that you won't need to use a password any longer from one machine to the other. At that point, you can have a cron scp the backups without it even requesting a password.
     
  6. Data 1

    Data 1 Well-Known Member

    Joined:
    May 25, 2008
    Messages:
    113
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Columbus Ohio
    cPanel Access Level:
    DataCenter Provider
    Hi,

    Both servers running cpanel.

    I did the "key thing" as described.

    I have SSH on alternate ports both machines.

    I logged into one (source for file) SSH then tried to connect to the other... returned a flashing prompt with no report.

    If I try: ssh 123.231.213.0 (fake IP for example) it returns "port 22 Connection Refused"

    But when I try the real port: ssh -p 12345 123.231.213.0 (all fake numbers for example) it just returns a flashing cursor. I tried disabling csf on both servers with the same results.

    I can ssh in to both machines from my home linux box as root no problem.
     
  7. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Add the -v flag to get verbose output. You definitely cannot SSH using the default 22 if they are on alternate ports, so that -p flag is going to be required with the port number being listed. Your cron will also require the port flag, which is uppercase P for scp so "/usr/bin/scp -P port# /backup/ root@destinationserver:/path" for example.
     
  8. Data 1

    Data 1 Well-Known Member

    Joined:
    May 25, 2008
    Messages:
    113
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Columbus Ohio
    cPanel Access Level:
    DataCenter Provider
    Hi,

    I added the port 22 output just to prove it was seeing something, was just a step in the debug.

    The output (changed IP's of course):

    OpenSSH_4.3p2, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008
    debug1: Reading configuration data /etc/ssh/ssh_config
    debug1: Applying options for *
    debug1: Connecting to 123.321.132.0 [123.321.132.0] port 12345.

    Then it just was a flashing cursor again.


    We have now strayed from the original subject, you can move this if you like or I can start a new or we can continue; at your discretion.

    Thank you-
     
  9. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    We could stay in this thread, but it's probably best to open a ticket since both machines are cPanel. We can try to figure out why SSH keys aren't working for the two machines to connect in that instance, since we provide the "Manage SSH Keys"s area in WHM.

    To open a ticket, you could use WHM > Support Center > Contact cPanel or the link in my signature. Please post the ticket number here when you open it.
     
  10. ossama

    ossama Registered

    Joined:
    Feb 6, 2011
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    hello,

    i'm new in dedicated server with WHM i would like to do the same with my server but a realy need help the do it right,

    i have a dedicated server i have configurate local backup and i want to transfer weekly or monthly backups to my local FREENAS.

    if i have understand what is in this topic
    1- I need to create SSH key in the server with "Manage SSH Keys" in WHM

    2- copy the public key from the server and put it the "/root/.ssh/authorized_keys" directory of my FREENAS

    3- run a cronjob with command SCP to copy the files
     
  11. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Hello ossama,

    Correct, you would need to create a key for your machine in WHM and then place that key onto the other server as an authorized key. At that point, you could then put a cron job in to scp the files to that machine so it wouldn't require a root password when running the scp.

    Thanks.
     
  12. Virtuacomm

    Virtuacomm Registered

    Joined:
    Aug 12, 2011
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    This should really be doable in cPanel without all this work... Because Plesk based control panels make multiple back ups very easy. You can create local backups and remote backups as separate jobs using the interface. No scripts are involved. And you can do configure backups on a per account basis, not just at the WHM level.

    Can we get this put on a feature request list?

    Thanks.
     
  13. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
  14. bikinhoki

    bikinhoki Member

    Joined:
    Aug 22, 2011
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    thank to post this treat. i mean this is very usefull for me. thank again fuji
     
Loading...

Share This Page