Automatically sync KeePass passwords between a PC and Mac (or even Linux)

2010 January 20

For the last few months I’ve been investigating some of the eminent password storage software out there. And encryption is really nice, but honestly, one of the most glaringly obvious uses would be so that I wouldn’t have to use the same passwords over and over again for websites that don’t store “critical data” (banking, identification, etc.) but require accounts to be set up for online use.

While I was enamored with 1Password (and still am) the biggest hurdle to it’s adoption is that I own a PC and a Mac (remember?). Syncing the password database between computers is therefore a necessity, and syncing across operating systems (XP/7 to OS X and vice versa) even moreso. This was certainly doable with KeePass and KeePassX, although KeePassX didn’t support a global auto-type hotkey. A password storage system is rendered virtually useless if every single time I have to log into a different web page I have to bring up the KeePassX window; copy my information to the clipboard, bring the focus back to FireFox, and type it in. Well, good news! An updated (albeit currently unsupported) version of KeePass (based on v0.4.1) adds auto-type functionality!

So now that we have auto-type everywhere, how to sync so we can use our KeePass databases everywhere we go? Well it’s very easy.

1.) If you aren’t using Dropbox yet, start. Go to Dropbox (click this link if you plan on following this tutorial, it’s the balloflightning’s referral!), set up and account, download the software, and set it up so both (or however many you have) machines are synced. Create a folder somewhere in your Dropbox scheme (by default under Documents -> My Dropbox) called “KeePass.”
2.) Download and install KeePassX (Mac) here. Download and install KeePass Classic (Windows) here. Note: We need to download the “classic” version because KeePassX still uses the old .kdb format instead of the new .kdbx. While we can set triggers in the new Windows version to automatically pop out a .kdb version AND a .kdbx every time we edit a password on that computer, we can’t edit .kdb’s on the Mac and automatically import them into KeePass on the Windows box. And that makes syncing unfun.
3.) On the Windows box (you can do it the other direction, too, but I found the Windows KeePass interface to be a bit more intuitive) open KeePass and create a new database. Set a “master password” and repeat. Don’t let this password suck too much; after all, you’ll be MINIMIZING the number of passwords you have to remember– at the very least you can do a good job coming up with a solid password that gives access to– well– everything else. Use a key file, too, if you’d like, but I find it unnecessary; it’s always something you can add later.
4.) Click “save as” and save the .kdb file to the directory you previously created within your dropbox scheme. Temporarily close KeePass on Windows and open KeePassX on the Mac. Browse to the newly created (and synced) database file and click open. Enter password. Try creating a few keys. Save. Close.
5.) Re-open the Windows version. Now you should only be prompted for the password (no browsing needed) and you should see your KeePass passwords in Windows. Congrats; you’ve done the heavy lifting!

A few notes; this will work between a PC/Linux or Linux/Mac as well. The same general steps apply although you will need the KeePass repo for your Linux flavor or you can compile from source. If you are a Linux user, I figure you probably don’t really need directions on how to do that. Second, KeePass (and therefore KeePassX) don’t automatically update the database while the program is running. Therefore, when you are adding keys be careful not to add different keys on different computers while both are still open. Dropbox handles conflicts well but you will lose some keys depending on what was open and what was being edited at the time. As a rule of thumb, when I first started migrating to KeePass I never had it running on more than one computer at a time. Once you have a stable database, it’s fine to have multiple instances going at once (it will typically ask to open in “read-only” anyways).

You can turn auto-type on and off by doing the following:
Windows: Tools -> Options -> Advanced tab -> Auto-Type button (lower right).
Mac: KeePassX -> Preferences -> Advanced

Some final notes to get auto-type running flawlessly on your computer. As a general practice, I had two lines to the comments of every key.

Auto-Type-Window: *balloflightning.com*

This aids KeePass/X in finding the window you want to auto-type in. I’ve found great success with the Firefox add-on “Hostname” which puts the domain name of the current web-site in the title bar. It may add a bit of clutter to your windows, but it provides you a surefire way to make sure KeePass/X is only auto-typing in the proper Firefox window/tab. The ‘*’ are wildcards, signifying KeePass/X will find whatever window has XXXXX balloflightning.com XXXXX in it. Obviously, you change the hostname between the ‘*’ to whatever key you are storing (i.e., paypal.com, ebay.com, etc.)

Auto-Type: {USERNAME}{TAB}{PASSWORD}{ENTER}

This is the custom sequence for the target window. {USERNAME} and {PASSWORD} are the stored username and password, {TAB} is… well… tab and {ENTER} is also self-explanatory. In some cases you may be forced to modify this (for example, I have to add a {TAB} after {USERNAME} every once in a while because the websites have a “click here to remember me” form.

Example Keepass custom sequence and target window

Some people will find that in OS X, tabbing will result in certain portions of forms (checkboxes, radio buttons, dropdowns, etc.) being skipped. This creates a bit of a problem here because the sequences will then not match between Windows and Mac. Solution?

1.) Open System Preferences
2.) Go to Keyboard & Mouse
3.) Select “All controls” for full keyboard access

Setting tabs in Firefox to include all forms

For a Firefox-only solution, you can also add / change the accessibility.tabfocus Firefox option via about:config to one of the following: 3 to be able to tab to form controls or 7 to be able to tab to everything

The dreaded “Gmail logout loop” and a painless workaround

2009 December 24
by Colin

I have a couple Gmail accounts; one is essentially my go-to e-mail for both business and personal correspondence while the other is used for any purchases, newsletters or “you need to create an account before you read this!” As such I am constantly logging in and out of both accounts to switch into one or the other. Lately, I’ve been running into what people call the “Gmail logout loop.” Some people claim they have also seen this on log-in, but thankfully I haven’t run into both problems (… yet). You’ll see an endless string of “waiting for www.mail.google.com,” “connecting to www.mail.google.com,” “transferring data from www.mail.google.com.” ad nauseum.

Simply closing the browser doesn’t work. In some cases deleting cookies doesn’t work. Whatever the problem ACUALLY is, but browser illiterate self found a simple, painless workaround until Gmail figures out what the problem is.

1.) Navigate to www.google.com
2.) Move cursor to top of page (this should cause the on-site toolbar to appear.
3.) Click “log out”
4.) Click “log in.” Enter login info.
5.) Click Gmail.

Voila. So far the pesky loop only happens with the www.mail.google.com connection, not www.google.com. Feel free to enlighten me as to why that is. Seriously.

GMail, IMAP, and Apple Mail = Slow?

2009 December 23
by Colin

I am finally getting around to getting GMail to play nice with Apple Mail on my Macbook, if only for the ability to work offline (i.e., when I’m 35,000 feet up) as well as have some form of coherent backup in the (hopefully unlikely) event that GMail kicks the bucket for an extended period of time.

I had tried to sync my GMail account once-upon-a-time, but decided it wasn’t worth the potential hassle. What hassle, I don’t remember– but in any event, I remember it was extremely easy to get it up and running using POP. However, this time around I decided IMAP was the way to go. Over the last few years I have slowly devolved into someone who uses GMail as my big e-mail cloud in the sky– that is, I want to be able to access an identical account (same inbox, sent, drafts, etc.) from anywhere (Macbook, PC, office, iPhone). IMAP should give me that ability.

Well, once I set up Mail to play nice with my Google account I noticed signficant slowdowns. I mean really, really slow. Like sending an e-mail that said “hello world!” took five minutes as the Apple pinwheel spun frantically. It seems like this a common occurrence with Mail 3.x and Leopard/Snow Leopard but there seem to be very few answers. I did end up finding one in the dusty corner of the internet.

It appears that Apple Mail has an issue with big attachments. I mean really big attachments. Like 20 MB big. Get rid of them, and it solves the problem. How do you do it? Well, there are two ways…

The easy way (tested by yours truly):

1.) Delete your IMAP account from within Mail by going to “Mail” -> “Preferences” and then clicking the little minus button below the account names. NOTE: I’m pretty sure this is foolproof with IMAP, but please, please make sure you are not deleting your e-mails from the server when you download them to your computer, because if you do that and then delete this account, well, you’ll lose your e-mails.

2.) Go into finder and delete the folder ~/Library/Mail/IMAP–/ or thereabouts.

3.) Go back into Mail, click on “Mail” -> “Preferences” and then the plus icon. Create your IMAP account as you did previously (make sure “create my account automatically” is unchecked or you will end up just creating a POP account with the default settings). This time, unclick “bring this account online” at the end of the creation process.

Don't check

4.) Go back into “Mail” -> “Preferences,” click on your GMail – IMAP account, then click on the advanced tab. Uncheck “compact mailboxes automatically” and MOST IMPORTANTLY set the offline viewing preference to keep “all messages but omit attachments.”

All messages, but omit attachments

5.) Set account to “online” and Mail will re-download all your e-mails; however e-mails and e-mails alone– no attachments. Everything should be running at Mach speed again.

Now, this way has one main drawback. You aren’t storing any attachments on your within Mail; if you want to download them, you have to do so as the e-mail comes in. This isn’t a problem for me, since I download the attachments I feel are important to whatever folder they are needed in by default and therefore don’t need another copy clogging up my inbox. However, if this is of crucial importance you can try the next step (at your own risk).

The hard way (I haven’t confirmed this works, but this would allow you to keep most attachments offline; only the ones over 20 MB are deleted– courtesy of bebopper):

1.) Quit Mail (Force quit if you have to)

2.) In Finder, click “Go” -> “Go to Folder.” Type the following folder path (replacing with your GMail User Name): ~/Library/Mail/IMAP–/.OfflineCache

3.) Look through the cached messages in this invisible folder and see if there is one or more larger than 20MB.

4.) Drag the offending large messages to the Desktop or Trash. Restart Mail, and Mail should stop hating you.

Both of these are essentially band-aids, so hopefully Apple will get its act together and figure out exactly what is going on. This seems to be a problem that has arisen in later incarnations of 10.5 and into 10.6, so it’s something that should be of pressing importance to the development team as we speak.

“Use Printer Offline”

2009 November 4
by Colin

Lately, I have been unable to print from my old (yet rock solid) Brother MFC-210C. The sequence of events is thus.

1.) The printer is automatically selected to “use printer offline.”
2.) Upon deselecting “use printer offline,” the print status of any documents in the queue is changed to “Error – printing” at which point anything in the queue will hang.
3.) The printer will reset itself to “use printer offline” upon power cycle or OS reboot, therefore leading to an endless cycle of 1, 2, and 3.

It turns out my issue was in the IOGEAR USB hub I use. I’m not sure if Windows 7 is having trouble dealing with the drivers (it was working in XP about a week ago) or the hub is just flat-out fried. Either way, I’ve seen a lot of threads on Google with the same problem but lack a resolution. Here’s one more thing to try, even if it’s a “well, duh.” If that doesn’t work, it can’t hurt to go with the always popular “reinstall the driver.”

“We are unable to create or save new files…”

2009 October 24
by Colin

Downloaded student discount Windows 7 upgrade tonight; upon trying to unpack the .exe that came down from Digital River.

“”We are unable to create or save new files in the folder in which this application was downloaded.”

Yeah. Thanks Microsoft. Here’s how to get around that.

Download oscdimg and then drop oscdimg.exe file into C:\Windows\System32.

Start -> Run -> type “cmd” to open a command window.

In the command window, type “oscdimg.exe -u2 -bC:\PATH\expandedSetup\boot\etfsboot.com -h C:\PATH\expandedSetup C:\PATH\Win7.iso” replacing C:\PATH\ with your actual path to the downloaded files.

You should now have an .iso file in that directory; burn a DVD using your favorite software (I used CDBurnerXP, but it’s old).

Restart and boot from the CD (specific to individual motherboards, my Biostar is F9, some are F8, some are the “Del” key). You should see something to the effect of “Press XX to select boot drive.” Press and select your DVD drive and follow the Windows 7 installation from there.

Thanks SIW2.

Windows 7 hanging at blue splash screen?

2009 October 24
by Colin

Windows 7 seemed to be stopping or hanging at the blue splash screen during installation this evening. Here’s the solution I found.

Unplug all peripherals except PS/2 mouse and keyboard.

Go into BIOS. Disable “USB controller.”

Remove/disable video card if you are bypassing the on-board graphics.

Boot the install disk.

Wait.

Wait.

Wait. (Seriously, like 15 minutes).

Follow install.

Reset everything back to “normal” following the installation. Apparently Windows 7 is having trouble with the drivers during installation, but does a reasonably good job downloading them afterwards.

What the iPhone knows about Derek Jeter

2009 July 14
by Colin

Jeter?

Deter Jeter is a Heterosexual

Heterosexual.

iTunes error -4 and iPhone OS 3.0

2009 June 17
by Colin

Trying to update to the new iPhone OS v3.0 and was repeatedly getting this error message in iTunes.

We could not complete your iTunes Store request.
An unknown error occured (-4).

There was an error in the iTunes Store. Please try again later.

Apparently, Rich Hauck has the solution.

1. Quit iTunes
2. Navigate to System/Library/Extensions and delete AppleMobileDevice.kext (you may be prompted to enter your admin information)
3. Restart iTunes

Directions are also official via Apple Support.

How to change a blower motor resistor, 1999 Dodge Stratus style…

2009 March 30

A few weeks months back, the heat in my poor little 1999 Dodge Stratus (it’s racked up like 30,000 miles in the last year– pretty impressive) began to have issues. Well I guess it had exactly one issue. The heat (and A/C) had exactly two settings. Freeze or swelter.

Some research on the interwebs told me that I was looking at a blown blower motor resistor– pretty much it fit my one-and-only symptom; my heat or air conditioning now had only one setting. (Apparently this is because the current running the high-speed setting on the fan bypasses the resistor, so it doesn’t care if the resistor has passed on or not).

However, the aforementioned interwebs did not have sufficient step-by-step directions that were explained so easy that a Caveman such as myself could do it. What follows is (and sorry for the lack of photography) a (hopefully) dumbed-down version of exactly how to save yourself from paying some fat, greasy mechanic with Dale Earnhardt’s number shaved into his back hair $100 to fix it for you.

Purchase yourself a nice new, shiny resistor. I originally wanted to buy from Autozone since I live a block away from them. I called them; they told me that had none in stock but they could order one for like $23– hoping to find one in town, I called Advance and they had one left for the bargain basement price of $14. I’m sure a plethora of other auto parts stores would have tripped over themselves to make a buck on a generic piece of plastic, so call around; it’s a part that’s a tad obscure, but you shouldn’t be paying more than $15-18 for one.

Disconnect the battery? Some people recommend to disconnect the negative (black) terminal on your battery before you do this. I did not because I’m lazy. However, remember, you are working in the vicinity of the airbags, so there is always a possibility something might go wrong. If you are one of these people who fears the unlikely, feel free to disconnect using a 1/2″ (I think?) ratchet and run a few wraps of electric tape around the cable end.

Pull the passenger side under-dash off. I refer to this as an under-dash because I’m too automobile-illiterate to know the actual term. Kickpanel? Floor panel? Whatever it is, it’s the plastic panel underneath the glovebox. (NOTE: Do not listen to anyone tell you anything about having to take the glovebox out! Under zero circumstances does the glovebox need to be removed. Unless, of course, you need to remove the glovebox for some other tedious task, in which case you probably shouldn’t be reading this for instructions on how to do that.)

Wait, how do you pull this panel off? Well it’s not really that simple. The trick with the Stratus is that there are two plastic plugs. If you are sitting in the passenger seat one is above your feet all the way at the back of the panel, smack dab in the center of the vertical portion of it that hangs down (about 6 inches above where the panel meets the floor). The second one is upside down on the right side of the panel, about 4 inches from the edge. These plugs are shady characters. A simple tug and they do not come off. A gentle spin and they do not unlock. No, they are the cheap, tapered, wedges-so-terrible-only-Satan-would-use-them pieces of garbage that only a designer for a failing American car company would love. The dirty little secret? You have to pull them. And you have to use a bit of force. The best way I found was to hold the panel all the way up against where it was attached (i.e., push it in the OPPOSITE direction of taking it off), at which point there will be a small gap between the panel and the head of the plug. At this point, you should be able to get a small pair of needlenose pliers on the shaft of the plug and if you pull-and-twist (sexual innuendo aside) you should be able to wiggle them off. Get the one on the right side off first, then the one in the back– once these are off, you should be able to slide the panel slightly to the right (there’s a little bit of overhang where it is close to the center console) and then pull out. Voila.

EDIT: As my astute commenters Jim and Jon have pointed out below, this is apparently much easier with a simple crowbar so long as it has a V-cutout. Figures I wouldn’t think of something simple like that, but hey– crowbar it is! Thanks guys, hopefully that saves anyone else aggrevation.

Take out the old blower motor resistor. This seems like the easiest part of the whole ordeal, so I won’t be too verbose. Sitting in front of you (a little to the right of center) should be the blower motor. Ahead of (towards the front of the car) and to the left of this should be the resistor (for those even more automobile-illiterate than me– it’s a plastic rectangle with two screws on either end). There should be two sets of wires dangling down. Remove these wires. It is important to depress a little clip along the side of each bundle to get it to “unlock” from the resistor itself. Take an 8mm (or 5/16″) nut-driver (preferable– you can also use a 1/4″ drive ratchet) and remove the old resistor by popping out the two screws.

Replace the resistor and slap the panel back on. OK, this is the easiest part of the ordeal. Put the new resistor into the slot where the old one was (note the same orientation). Screw it back in using the screws you just pulled out; and reattach the wires as such. Almost done! Put back the kickboard (under-dash– whatever) by pushing it back (and sliding it a bit to the right) and push those plastic pins (if you didn’t snap them off) back into their little holes; knowing full well the next time you get back under here, you’ll still be cursing their existence. On the off chance you get pissed off and “accidentally” snap one like me, you can always run a Philips head through the kickboard into the mount for easy (improved) future removal!

Turn on the heat and bask in being able to drive without having the throttle the fan every 30 seconds to keep the inside of your car at a reasonable temperature. And even better; don’t forget the ego boost you gain because you feel that you are kinda-sorta capable at performing extremely (but worthwhile) basic auto repair tasks!

Dual partition a USB drive for Time Machine and Windows

2009 February 17

I just picked up a Western Digital 1 TB Element hard drive for under $100 from Dell SB. As a hedge against data loss, I’m using it as an inclusive backup for my Macbook (via Time Machine) as well as some important media files on my Windows/Ubuntu box.

There are two reasons I want to partition this drive. One, Time Machine has no feature that allows you to bound the size of the backups. Therefore, it will keep adding incremental backups without removing older data until it runs out of room on whatever drive you are using. Considering I only have a 160 GB hard drive in my Macbook; wasting 1 TB of space is pointless, and partitioning a portion of the free space for Time Machine allows it to be “bounded.” Secondly, by partitioning the drive with two file formats, I can easily attach the drive to my network (via Airport Extreme, for example) and have it be accessible from all my computers. Therefore, simple Windows backups using SyncBack can be done using the same disk as no-touch backups using Apple’s Time Machine.

So how do you set up two partitions on an external USB drive– one for Time Machine and one for using with a Windows box?

    0.) NOTE: FORMATTING PORTIONS OF HARD DRIVES WITH DATA WILL ERASE SAID DATA. IF YOU ARE A NOVICE AND HAVE DATA ON AN EXTERNAL HARD DRIVE YOU WOULD LIKE TO PRESERVE, I WOULD RECOMMEND MOVING IT TO ANOTHER LOCATION OR USING A DIFFERENT HARD DRIVE FOR THIS TUTORIAL!

    1.) Plug your USB external hard drive into your Mac.

    2.) Open Apple’s “Disk Utility” — this can be found in the Utilities folders within the Applications directory.

    3.) On the left hand side, you will see the hard drive you wish to partition — you will likely see the manufacturer name (HD, not necessarily enclosure) — match the manufacturer and size. Select this drive (the top level, not any sublevels within the drive).

    4.) Select the “Partition” tab on the top of the right side of the utility window.

    5.) In the “Partition” tab select the number of partitions that you want from the ‘Volume Scheme’ drop-down menu. If you are planning on using a two-partition scheme like me (one for Mac, one for Windows), select “2 partitions.”

    6.) Select one of the partitions by clicking on one of the “boxes” underneath the dropdown menu. They will likely be named “Untitled X.” When a partition is selected it will be bounded by a blue border and you will notice that both “Name” and “Format” are available.

    7.) Start with your Mac (in my case, Time Machine) partition. Select a name, size, and choose either Mac OS Extended (Journaled) for a partition that you will use with Time Machine or use as a boot volume. Select Mac OS Extended (No Journaling) if you wish to use this partition for Mac media or data storage.

    8.) Select the other partition by clicking on it. For a Windows partition, select “FAT” from the drop-down menu.* The name is not case-sensitive (i.e., must be in all CAPS) and cannot contain spaces. I typically will name this “WINEXT” or “WDWIN.” Something short and sweet in case you need to browse to it through a shell.

    9.) Select each additional partition (if any) and then name and set the format.

    10.) Click “Apply.”

Voila! You now have a drive that Time Machine can use for Macbook backups, but you also have a partition for media/data file storage on your other boxes as well!

*NOTE: Some people have e-mailed and asked “why FAT? NTFS is more awesomer!” Well, I agree that NTFS is the better file standard; however, as of 10.6.1, OS X still did not have the capability to write to NTFS drives; so FAT is the preferred solution here because it would allow you to write/edit the secondary partition from your Mac if needed.