Using a Western Digital My Passport Ultra on Linux

I’ve been trying to build a home file server, mostly to store backups, using a Raspberry Pi and a Western Digital My Passport Ultra as the main storage unit. For years, I used an old Compaq desktop tower as my backup computer, but the fact that it won’t turn on and the fact that it would cost more to fix it than to just buy a Raspberry Pi has lead me down this new road.

But after I bought the My Passport Ultra, I tried to plug it into my laptop, running Debian Sid. It would mount, but I could not access it through the file manager or on the command line. At first, I did what any good Linux user (or librarian) would do: I googled around for an answer. According to everything I read, the encryption on the My Passport Ultra required a Mac or Windows computer to decrypt, and even then you would still have a vestigial piece of their encryption on the drive.

I first tried to use their decryption software using Wine; that didn’t work because it couldn’t find the drive, even though it was plugged in and I had used winecfg to make sure the drive was discoverable. I then tried to use my wife’s old Mac, but quickly remembered why she doesn’t use it anymore and why I got her an Android tablet for Christmas last year: every 20-60 seconds, it would shutdown and reboot, so I didn’t ever have time to try and even download the decryption software.

However, being a Linux user, I decided to just try stuff. So I plugged the drive back into my computer. GParted would not run and would not recognize the drive, so I couldn’t format it that way. However, I finally found a solution, and a simple one at that: I unmounted it and then just ran the most basic formatting command out there.

sudo mkfs.vfat /dev/sdb1

Completely blew threw all of the My Passport Ultra’s supposed encryption (which I think was just software encryption, and nothing on the drive itself was actually encrypted) and made the whole thing completely usable by me. I later formatted it into btrfs for use on my file server, and it is now receiving an rsync of all of the pictures, music, and files from my laptop. Since there is so many threads out there about how it isn’t possible to use this drive on Linux without freeing it on a Windows or Mac computer, I figured I’d write this up so people know that yes, you can do it just on Linux.

Hosting your website on a Raspberry Pi

A couple of years ago, I hosted this website and a couple others on my first-generation Raspberry Pi. However, it didn’t quite have enough power to even support my light usage, and so I went over to DreamHost (started with a very cheap promo deal, which went up to $120 in my second year). This year, my second renewal at the $120 level was coming around, and I thought that that was a lot of money to spend on my website when I have the skills to host it myself.

In the intervening years, I had purchased a Raspberry Pi 2, and it really is a great option to host a website on. With 1GB of RAM and a 900 mHz ARM chip, the power that you’re getting is actually fairly similar (or even better) to what the lowest tier paid hosting sites are giving you. With that in mind, I went back to my Raspberry Pi to get it going and replace my paid hosting with a computer that sits behind my television.

The first thing that I did was to download Raspbian; it is the primary supported Raspberry Pi distribution, and I have a long history with Debian. I did make sure to disable the graphical user interface since I don’t need that on a server and so it runs with a little less overhead. Debian stable is always a great base off of which to build a server, and the current version of Raspbian is built on Debian Jessie. I’ll leave it to the documentation of Raspbian and Raspberry Pi themselves to tell you how to install your system.

I’ve wanted to try out using nginx for a while, but with a time crunch before my DreamHost payment was due, I just went for the old standby: Apache. I can configure Apache in my sleep these days, and so it went quickly and easily.

After doing an “apt-get install apache2” and a “a2enmod rewrite,” you should be ready to create you site configuration file. In the past, I used to struggle to to find the right settings to make the permalinks pretty, but I’ve finally found the right site config to make either simple.

Copy that template into your /etc/apache2/sites-available folder, and name it something like yoursitename.org.conf . Change all of the information to match your site, and then run “a2ensite yoursitename.org” to activate it. You’ll also need to run a “service apache2 reload” to get Apache going.

You’ll need to put your whole site in the document root found in the site configuration file above. You can hand write HTML in there, or you can go for a full CMS like WordPress, Drupal, Ghost, or many, many others. Once you’ve put the files there, I recommend changing the owner of the files to the www-data user; it helps provide some security should your site be attacked. “chown -R www-data /var/www/yoursitename.org” should get that done for you.

On this site, I installed MariaDB (a drop-in replacement for MySQL) and then WordPress, but your choices are endless. I have two sites running on a single Raspberry Pi right now, with a third coming shortly; a “free -h” shows that I’m using 182 MB of memory right now.

IMPORTANT UPDATE: Now, to get your site viewable on the larger internet, you have to get your DNS settings straight. Go to your domain name registrar (I use Hover), and go to the DNS tab. Find out what your public IP address is: you can either do it by logging into your router and poking around in there or by Googling and going to one of those sites that tell you.

I was not really able to get IPv6 to work by itself, so I added both the IPv4 and IPv6 address to my registrar’s DNS record. You put your IPv4 address in an A record, and the IPv6 in a AAAA record; I just left the hostname part blank and just added the addresses. Once you save those it should take about a half hour or an hour for the new location of your address to populate to all the DNS servers around the world, and then typing in “yoursitename.org” should actually take you to your site.

Your public IP from your ISP may change from time to time, so if your site is suddenly not working check this first.

A Raspberry Pi 2 is a pretty good option for hosting a fairly-low activity site, like a your personal resume, personal website, or a website when you’re just starting out and don’t want to pay for hosting.

Turn your Raspberry Pi into an easy VPN using OpenSSH

There are plenty of tutorials out there on how to turn your Raspberry Pi into a full-fledged VPN, often using OpenVPN. However, many people don’t need all of the features (and all of the setup) of a full VPN server in order to just protect their browsing when they are on unsecured wireless networks (or for whatever other reason you would want a VPN).

Enter OpenSSH. Most of you know it as the program that lets you login to other computers and servers through the command line; for a long time, that’s all I did with it too. However, you can use it as a simple VPN on your Raspberry Pi as well! First, go into your router’s settings and make sure that you have a port open through which your VPN will go; personally, I use port 3312. Then, run the following command on your Pi:

$ ssh -TCD:3312 username@localhost

Where username is the name of your user on the Pi; you will also be asked for that user’s password at the time. Then, all you need to do is configure your browser to use that to connect to the internet. Go to Preferences->Advanced->Network->Connections and click on Settings. Select “Manual Proxy Configuration” and enter your home’s public IP address as the “SOCKS Host.” Put in 3312, or whatever port you chose to use, in the port field and everything should work fine. When you end the ssh session, the proxy will stop working, so remember to switch your Firefox preferences back to “No proxy” or you won’t be able to browse. It is that simple!

AOI, now powered by Raspberry Pi!

Among Other Items, my humble blog, has been undergoing a bit of a change behind the scenes. Formerly, this site was powered by an old desktop computer, probably released in 2002, which had been converted into a Debian server. Now, this site is powered by a Raspberry Pi, a $35 computer which is running a variant of Debian. I can tell that the site is a little slower, but its worth it for the ability to experiment with this new little machine and because of the power savings it will reap.

If you want to learn Linux, I highly recommend getting a Raspberry Pi. Lifehacker has a lot of different recommendations for projects that you can try, and I will probably have some too if you are interested!