Monthly Archives: October 2009

MySQL Backups from Hosted server

My hosting provider WrenMaxwell provide servers with cpanel and if you ask for it ssh access. The MySQL access is restricted to just ‘my’ database(s) and in order to include these in my remote backup solution I wanted to automate the process.

SourceForge AutoMySQLBackup is a simple but very effective script. I uploaded it, set the common settings and ran it.

Adding it as a cron job will run it daily while adding some tweaks to my website backup script on my remote server now includes the resultant backups offsite as well.

Backups using Rsync website to home server

I have remotely hosted websites and my home network. Following some recent almost disasters I figured that it was time to create some automatedbackup processes.

So I started with one remote site and my SMEServer at home and used Troy’s guide mostly.

One change was that I have alternative port settings for SSH connections, so I had to modify this line:

$ rsync -avz -e ssh remoteuser@remotehost:/remote/dir /this/dir/


$ rsync -avz -e ‘ssh -p 3333’ remoteuser@remotehost:/remote/dir /this/dir/

the single quotes around the ssh command separates its parameters from the rsync parameters so you can add other ssh options if needed.

Making the keys etc worked fine, but a similar setting is required when transferring via scp.

scp /home/thisuser/cron/ remoteuser@remotehost:/home/remoteuser/

changes to

scp -P 3333 /home/thisuser/cron/ remoteuser@remotehost:/home/remoteuser/

note that ssh uses -p (lowercase) while scp uses -P (uppercase) to change/set the port #.

I also liked Troy’s verbose ‘whoami’ line

$ echo I am now $USER at $HOSTNAME

but I also used

$ pwd

to check what directory I was actually using before continuing.

Two things tripped me up when testing just prior to the cron job configuration.

So to debug I started by stripping the authorised keys back to just the certificate and it was fine. I then added in the command string to that file and tested again only to get a password prompt.

The issue was that I had the validate-rsync script on the local host and not the remote server so I copied that file to an appropriate location on the remote host and tried again and that worked.

The second issue was with the ‘from=’ host setting in which I tried the hostname rather than ip address and rsync did not like that at and again prompted for the password. Changing it to the ip address worked. Not sure why this is as all the documentation I have read indicates that the text option should work. I’ve left it as the ip address for now.

Having done that and proved that it all worked added a new template into /etc/e-smith/templates-custom/etc/crontab called 70remotebackups and added these lines:

$OUT = “”;
# note to self as to what this is doing
$OUT .=
“05 2 * * * root” . ” /home/e-smith/files/ibays/backups/files/scripts/myremotebackup.shn”;

This is setup so that I can add another site script into the same crontab component file.Then I ran the process to include my new custom template into the crontab file.

/sbin/e-smith/expand-template /etc/crontab

No need to restart anything as cron will pick up the changes automatically.

Throughout all the testing I have already got the first initial copy of my entire website and a few changes so thats all working nicely.

The next step at some point is to prepare further copies of the same stuff in order that I can recover intermediate changes when required. But that is another day.

Windows 7 connect to Samba Domain

Windows 7 has some special requirements for it to become a member of a Samba based Windows domain.

I worked through a number options including trying the old Windows XP solution of changing the registry settings NetlogonParametersRequireStrongKey but this did not work.

There are also many mentions of the Network Security: LAN Manager authentication level change to “LM and NTLM – use NTLMV2 session security if negotiated” but that did not work on the two systems I have tried and after setting that back I changed just the two LANmanWorkstation settings as per this link.

Worked fine with both an older Windows 7 downloaded installation and on my Windows7 notebook from TechEd AU 2009. But it failed on a Dell system that has been upgraded to Win7. Still working on that one.

An Update:

I updated the Samba version on the SMEServer that I was trying to connect to from Samba v3.0.33 to Samba v3.2.15 (using the sernet archive) and tried to connect the Dell notebook again using the modified registry settings as per this post and it worked first time.

SMEServer 6.0 SSL Certificate

I had the SSL Certificate expire on an older SME Server install during the week and went to fix it all this morning. I went looking for a quick set of instructions and used which worked fine on the server.

Problem was that the Firefox browser on the workstation I worked from reported a duplicate certificate serial number had been identified and therefore the site was still blocked.

I had to clear the old certificate from the Tools->Options->Advanced->Encryption->View Certificates screen to get access working.