View Single Post
  #13 (permalink)  
Old 07-12-2009, 11:35 PM
cPanelEricE's Avatar
cPanelEricE cPanelEricE is offline
cPanel Staff (Administrator)
 
Join Date: Nov 2007
Location: Texas
Posts: 170
cPanelEricE is on a distinguished road
Howdy,

You may need to clean things out before you backup for the day. A little rm'ing with the same logic you used to make the file should do the trick. I'll show you how to do that remotely in a second.

Backing up via remote can be done in a lot of ways, ssh, sftp, ftp and on and on. I like scp, but it may not be for you. First thing you need is a remote machine.

On this remote machine you need to make a backup user to accept the backup data. I don't recommend backing up as root or your personal use user. Let's make this a little out of the way for now, so it can't be easily deleted.

Also try and avoid the obvious user backup, I can't count how many times I've seen a brute force script start with root, then admin, then backup. With this user make him a super long password that you're likely to never use. Taking the md5sum of a random logfile works nicely.

Now we've got a user to get the files, let's setup the method to authenticate between the two. For that we're going to use SSH keys. I could type this all out and make this lengthy post longer but I'm just going to link to it.

HOWTO: set up ssh keys

Once you can ssh from the cPanel server to the backup server without password interruption you're ready for scp. The scp command should look like this:

scp /path/to/filename username@HostnameOrIP:/path/to/backup/dir

add that on to your backup script and you'll be good. I'd let it run a few days to make sure you're getting the files in both places. Once you're sure it is add an RM line in to clear out the cPanel server to keep your quotas in check.

I mentioned running commands on remote servers and here's how you do that.

ssh user@HostnameOrIP 'remote command'

I few common gotcha points..
-Make sure you're sshing as the right user
-Make sure the authorized_keys and authorized_keys2 files are 644

Enjoy!
__________________
--Eric(E)

Using Enkompass compared to cPanel is like going to a MacDonald’s in France, sure they’ve got the same things we have over here, but it’s a little different.
Reply With Quote