If you want to safely guard your passwords, you should first understand
how your password could be “stolen” or discovered. Here are some
scenarios.
You tell someone.
Oops. Either you actually tell them (be careful who you trust) or you enter it on a phishing site or respond to an email (don’t do it!).
What you can do: protect your passwords by never telling anyone, for any reason. Minimize the potential damage by using different passwords for different sites.
Someone guesses your password.
Maybe they try your phone number or your birthday or something else that they know about you.
What you can do: try to choose passwords that aren’t about you. Choose random words from the dictionary. If your brother could guess in 5 tries what your password is (or all but one letter of your password), then you should use a different password. Not just because your brother might one day try to steal your identity, but because if he knows something about you, then your Facebook friends can probably do too.
Someone steals your password over wireless internet.
There are two main kinds of encryption happening when you use wireless internet. First: if you are visiting a “secure” site, the kind where the URL starts with https, then the stuff you send is encrypted from the moment it leaves your computer until it is received by Google’s or your bank’s computer. Big companies (Facebook, Google, Microsoft, Amazon, your bank) will at the very least make sure your password is sent in this secure method. Often they will encrypt everything you send or receive. Smaller websites may not.
The second encryption happens when you are using secured wireless, the kind where you have to enter a password. In this case everything you do is encrypted from the your computer to the wireless access point.
If you are using unsecured wireless and entering your password into an unsecured site, then anybody on the same wireless network as you could be running a program that intercepts your password and steals it.
What you can do: Don’t mix passwords. If you can’t use a different password for everything, you should at least not mix important passwords (which are likely to be safe by method one) with less important passwords. If you use the same password to log into your bank or email as you do to log into some Harry Potter fan site, you are asking for trouble.
Someone hacks into one of the websites you use and discovers your password.
This is much less likely to be a problem for reputable websites for many reasons.
What you can do: Again, don’t mix passwords. If you are dead-set on using the same password for everything, possibly changing the last number at each website just to make things slightly different, at least increase your password pool to two. Use one password for your bank and email and the other for everything else.
Note: I’m not actually recommending this. I’m saying this is the least you should do.
Summary
Use a complicated password that no one can guess. Make it kind of random, not about you. If they let you, make it a phrase, like “trees eat ice cream.” This is easy to remember, easy to type, and much harder to guess than “(your-middle-name)2!”.
Use different passwords for different places. Even if you have to write it down somewhere. Use 1Password or something similar to keep track of your passwords. Or if you’d rather, write them in a notebook that you keep in that locked desk drawer that you never knew what the lock was for.
I have been using Unison to
sync files for the past several years. It does a great job, and can sync
between Windows, OS X, and Linux computers. Of course, nowadays you can
also use Dropbox for this sort of thing, if you
don’t mind the space constraints and security issues. Allway
sync was once my favorite sync program, but it
only syncs Windows machines. It took a bit to get Unison going, and I
never got the GUI to work, but for the past 3 years it has synched my
files both ways without any problems. I have always used these
binaries. If you are
going to be synching from one computer to another, you will need to
install the same version of Unison on both machines. It syncs via ssh,
and only sends the pieces of the files that have changed. I always run
unison from the command line (usually through a LaunchAgent), as
follows:
-perms 960 This mask is applied to permissions of everything. Note
960=0o1700, so in my case I am making sure that my local files
(which are usually world-readable by default) are only readable by
me on the server.
-auto syncs without asking, unless there are conflicts
-addversionno calls unison-40 instead of unison on the remote
server. I need this because the remote server has a really old
version of unison installed.
-batch -silent Ignores conflicts completely, instead of asking the
user, and prints no output. I only use these in the automated
version that runs once an hour. I rarely (less than twice a year) have
conflicts.
For a while I’ve been wanting to create a private link system. Google
Docs, Dropbox, YouTube, and others all give you the option to make a
file public but “unlisted,” with a long link that no one will likely
guess. You can email the link to others, and no one has to worry about
usernames or passwords. This week I implemented a rudimentary system as
a Python cgi script.
Schematic
Each file is assigned an id. The ids and corresponding filenames are
stored in a text file. When a user requests and id, the Python script
checks if the id is in the table, and, if so, serves up the appropriate
file. If the id does not have a corresponding file, the user gets an
error message.
The id
You can use anything you want here, really. I use a 10-byte id encoded
in base 32 as a length-16 string. You could really use a shorter id and
still be okay. The nice thing about base 32 is that it is URL safe, and
it doesn’t use 0’s, 1’s or 8’s, to avoid confusion with O’s, I’s, and
B’s. You can generate an id using the following code:
I store the ids in a text file that looks something like this
NRTDBP5QYKN3WGYP some-file.pdf
WMADW3QOSHSCATWY another-file.pdf
UEGGUKOMB5FXWNR2 a third file.pdf
Serving up the file
As with any cgi script, you just need to print everything to stdout,
starting with the headers. The headers I want to use are
Content-Type: application/pdf;
Content-Disposition: inline; filename="name of file.pdf";
Content-Length: (size of file in bytes);
You can replace “inline” with “attachment” if you want the browser to
download the file instead of displaying it in the browser. Don’t forget
the quotes around the file name if it has any spaces or special
characters in it. Also, don’t forget to send a blank line after the
headers and before sending the content. Then you finish it off with
So far, the user needs to enter a URL in the form
http://example.com/?id=NRTDBP. With the help of mod_rewrite, we can
accept URLs like http://example.com/NRTDBP. Here is the relevant
.htaccess file, taking into account that the Python script is named
index.cgi.
[As of the most recent upgrade of the Seattle Public Library’s
website, you can no longer access your checkouts or holds by RSS, so
this no longer works. Sad.]
When I was a kid, my mom used to save all of the receipts from the library
and when it was time to take the books back, we would check each one off
to make sure none were left behind. Nowadays, you can just check the
library website, but that can get tedious: log into my account, find out
which books I have checked out, find out which books are on hold, long
out of my account, log into my wife’s account, repeat. And soon my kids
will have accounts too? So much clicking! Ahh! Luckily, the Seattle
Public Library offers both your holds list and your checked-out list in
RSS/XML format. It was not hard to write a script to download
the RSS file, extract the useful information, and display it nicely. For
a long time, I ran this once a day using a LaunchAgent on my home computer. This was inefficient, so I finally decided I should understand how cgi scripting
works, because up till now php was the only web scripting I had done. Of
course, I was embarrassed at how easy
cgi scripting really is.
The Python script
The script uses Feed Parser to parse the
RSS, which makes things easy. The main idea is this:
feed=feedparser.parse("http://example.com/feed/")booklist=feed.entriesforbookinbooklist:printbook.title#the title of the RSS entryprintbook.summary#the summary of the RSS entry
Other than that, the script is doing some basic extraction using
str.find and some list sorting.
Making it work as a cgi
This program is the simplest possible cgi script, because it requires no
input. The idea behind cgi is that everything that the program outputs
is served to the user. The only thing you have to do is begin your
output with an html header like this:
print"Content-Type: text/html; charset=UTF-8\n"
Remember that your header should be followed by a blank line, as above.
Of course, you should also be careful about catching errors so they aren’t
inserted into the html. The script is here:
library.cgi
The computer people just installed an iMac in my office to
replace a very old computer that was running Ubuntu. Unfortunately, they
installed it with a run-of-the-mill keyboard that has the Alt key next
to the space bar and the Windows/Super/Command key between Ctrl and
Alt. My brain can’t handle it, so I started searching for a keyboard
remapper. Eventually I discovered that the ability to remap the modifier
keys is built in to Mac OS X. You just go to System Preferences ->
Keyboard and click “Modifier Keys.”