This is a personal weblog. The opinions expressed here represent my own and not those of my employer. This website is intended for my own personal amusement and a digital “file cabinet” of sorts for things I have found useful. Use any and all information on this website at your own risk. There is no way that I can gauge your intelligence through the interwebs, therefore this entire website and its contents are use at your own risk! Thanks and enjoy your stay 🙂

Syncing Filezilla Sites across Computers with Google Drive / Dropbox

1. Find your site manager file
Filezilla keeps all of your sites and access credentials in an XML file called “sitemanager.xml” Here are the most likely locations:
Windows 7 & Vista – C:\Users\Yourname\AppData\Roaming\FileZilla\sitemanager.xml
Mac OS X – /users/Yourname/.filezilla/sitemanager.xml
Linux – /home/Yourname/.filezilla/sitemanager.xml

2. Back it up
Just in case something goes wrong in the next few steps. Copy the file and name it something else, perhaps “sitemanager.xml.backup”

3. Move sitemanager.xml to Google Drive
I keep a folder in google drive called “Settings” which I use for program files that I sync. Place it where it makes sense to you, just remember that location for the next step. Note, you want to move the file, not copy it. It cannot still exist in the filezilla folder, or the next step may not work.

4. Make a soft link from Google Drive back to your Filezilla folder
Filezilla will still look in it’s default place for the sitemanger file. You’re going to trick it and point it to the file you have snyc’d on Google Drive. You’ll need to open up a Command Prompt (Windows) or a terminal (OS X/Linux) for this step. This is what the commands looked like for me, you’ll need to adjust the file paths as necessary. Note, on Windows, you enter the new link first, then the existing target, and on OS X & Linux, it is the opposite order.

mklink “C:\Users\ian\AppData\Roaming\FileZilla\sitemanager.xml” “C:\Users\ian\Google Drive\Settings\sitemanager.xml”

ln -s /users/ian/Google Drive/Settings/sitemanager.xml /users/ian/.filezilla/sitemanager.xml

ln -s /home/ian/Google Drive/Settings/sitemanager.xml /home/ian/.filezilla/sitemanager.xml

That’s it! Fire up Filezilla, and you should see the same site settings now on all of your computers. Note, if you use “Synchronized Browsing”, you’ll need to create separate bookmarks under each site for each computer, as the local path to your files will be different depending on your computer.

WordPress MySQL Find / Replace When Moving Domains

Great piece of code to use when moving a WordPress site from one domain to another; quick way to replace the old domain name in the DB with the new one.

UPDATE wp_options SET option_value = replace(option_value, 'http://olddomain.com', 'http://newdomain.com') WHERE option_name = 'home' OR option_name = 'siteurl';

UPDATE wp_posts SET guid = replace(guid, 'http://olddomain.com','http://newdomain.com');

UPDATE wp_posts SET post_content = replace(post_content, 'http://olddomain.com', 'http://newdomain.com');

UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://olddomain.com', 'http://newdomain.com');

Adding Storage to Linux

There are plenty of articles out there on how to add new storage to Linux.  This is something I don’t do that often, so I’m going to document it here for future reference – maybe it’ll help someone as well.

My Linux VM is a CentOS 5.5 64-bit machine running on ESX 4.1.  I’ve directly attached iSCSI storage to it within vSphere and now I need to have the VM actually see the storage.  To the command line!

The first thing to do is make sure Linux sees the new drives:

  • fdisk -l | grep Disk

You should see something like this:

  • Disk /dev/sdb:  1099.5 GB, 1099511558144 bytes

Obviously, your GB size will vary depending on the size of the drive/storage you are trying to attach.  The above example is what I see because I’ve added a 1TB data store to my VM as a directly attached drive.  That being said, the next thing we need to do is create a partition:

  • fdisk /dev/sdb
  • n  – create new partition
  • p – primary
  • 1 – tell the drive what partition number it is (in my case it was the 1st partition)
  • defaults (just press “enter”) – the rest of the options, I just use the defaults because I wanted to use the whole drive for storage.  You can adjust these to your liking.
  • w – write the new partition table and exit.

Now we need to format the new drive using whatever type of file system we want.  In my case, I chose ext3 so I entered the following:

  • mkfs.ext3 /dev/sdb1 – prepare to wait a while depending on the drive size.  Note here, that with the new partition, you now see /sdb1…not just /sdb.  We will be working with /sdb1 moving forward.

Once this is complete we need to create a mount point for the new drive and then actually mount the new storage.  You can create a directory anywhere you wish, but I recommend creating a folder in the /mnt/ directory for best practices:

  • mkdir /mnt/something – this creates the directory where Linux will access the storage
  • mount /dev/sdb1 /mnt/something – note that “something” means for you to pick what you want it to say.

Once this is done, you can verify your new drives are working by using:

  • df -H – this will show your mount points and drives.

The last thing to do is, we need to edit the fstab so that these drives are mounted when the system is booted:

  • vi /etc/fstab – this opens, in vi (you can use any editor here – nano, etc.), the fstab for editing.  Enter the following for each drive you want mounted on boot:
    • /dev/sdb1     /mnt/something     ext3     defaults     1 2
  • Save your changes and exit the editor.

That’s it!  You now have usable storage for Linux.  This is just the tip of the iceberg; you can set partitions to boot, create multiple partitions, change the file system to any number of other choices, etc.  As always, let me know if you have questions or see something wrong!  Good luck!

Crashplan Pro Server – SSL Error Fix

One of my clients runs their own Crashplan Pro server and needed help installing their SSL cert.  I came across an error and thought I would post the fix here.  Keep in mind that I’m using GoDaddy for the SSL but the error we’ll get is related to the Java Development Kit (JDK) install on the server.

First, Crashplan’s SSL setup tutorial lists the commands to generate a key and your CSR.  Let’s generate the key first:

  • keytool -genkey -keystore keys.jks -alias tomcat -keypass tomcat -keysize 2048 -keyalg RSA -storepass tomcat

I have changed the key size to be 2048 – GoDaddy requires this.  Crashplan’s command originally sets the key size to be 1024.  Next, generate your CSR:

  • keytool -certreq -v -keystore keys.jks -alias tomcat -keypass tomcat -file test.csr -storepass tomcat

Send that CSR to your CA (GoDaddy, etc.) to generate and download your cert.  Next, the error.  Crashplan says to install the cert:

  • keytool -import -keystore keys.jks -alias tomcat -file your.domain.com.crt -trustcacerts -storepass tomcat -keypass tomcat

…and we get this: “Error: java.lang.exception: failed to establish chain from reply”

In a perfect world, the “-trustcacerts” should have overridden the security check and installed the cert.  Alas, it did not.  I did verify that GoDaddy was listed in my /cacerts for JKE but it still didn’t install the cert correctly.  To fix this, you need to install the intermediate cert that you should have received from your CA:

  • keytool -import -trustcacerts -alias root -keystore keys.jks -file gd_intermediate.crt -storepass tomcat

Keep the -alias as “root” – don’t change it to tomcat to match Crashplan’s previous instructions or it won’t work.  You should receive a message stating that your intermediate cert has bee installed successfully.  Now, go back and run the import again for your SSL:

  • keytool -import -keystore keys.jks -alias tomcat -file your.domain.com.crt -trustcacerts -storepass tomcat -keypass tomcat

That should successfully install your SSL.  Once that’s done, you can continue your Crashplan SSL setup.  Good luck!