Category Archives: linux

On this page:

Setting up dynamic DNS with Tomato and Namecheap, and limiting SSH

We have a computer downstairs with backups of files, and I’ve been using it to explore Vagrant and development using virtual machines as well. It can be useful to be able to SSH into it from outside our network, so I spent some time setting up a dynamic domain name, port forwarding, and new limits for the SSH server.

Namecheap (the domain name registrar that I use) supports dynamic domains, so it was easy to enable.

  1. Enable dynamic domains: Manage Domains, choose the domain, and then choose Dynamic DNS. Enable it and copy the password.
  2. Create an A record: Choose All Records and add a subdomain with a temporary address (ex: and type A. Save the settings.

Our router uses the Tomato firmware, which has built-in support for Namecheap and other dynamic DNS provider.

  1. Click on BasicDDNS.
  2. Fill in the details for Dynamic DNS 1.

Before I forwarded the ports, I wanted to make sure that SSH permitted password authentication on our local network but required passphrases for external connections. OpenSSH: requiring keys, but allow passwords from some locations (Michael W. Lucas) was really helpful. I edited /etc/ssh/sshd_config, set PasswordAuthentication no, and added the following lines to the end of the file:

Match Address
  PasswordAuthentication yes

(I had some problems in the beginning because I typed this as Yes instead of yes… Case matters!)

I restarted the SSH server with service ssh restart and confirmed that I could still SSH in.

Back to Tomato. Port Forwarding lets you set up forwarding rules. The port for SSH is 22, so I filled in a row with the port I wanted, the internal port, and the internal IP address of the server. I clicked Save (forgot to do this a few times because the button was near the end of the page) and that was that.

On Windows, I walked W- through generating a DSA public key with PuttyGEN, loading it in Pageant, and copying it to his .ssh/authorized_keys2 file.

Posting this here because I’m probably going to want to do this again someday, and it took some searching around. Besides, someone might find it handy!

Working with FTP sites

One of the Drupal sites I’m working on is on a web host that allows only FTP access, not SSH or SCP access. I set up a local development environment so that I can play around without affecting the integration or production site. This also lets me use drush to do a group upgrade of modules without downloading and installing them one by one. But without the convenience of rsync over ssh, how can I easily transfer my updated code to the server?

lftp is a free Linux/UNIX tool for working with files over FTP. Packages are available on major distros, so installing it as easy as apt-get install lftp or working with your distro’s package manager. To start an lftp session, type lftp user@host. It supports the usual FTP commands, but it also has a few nifty additions. For example, here are some commands I use often:

lftp mirror somedirectory :: Recursively copy somedirectory from the remote computer to the local computer lftp mirror -R somedirectory :: Recursively copy somedirectory from your local computer to the remote computer lftp mirror -R somedirectory destination :: Recursively copy somedirectory to destination – saves me a lot of cd and lcd-ing lftp mirror -R --dry-run somedirectory :: Don’t actually copy somedirectory; print out the commands that would have been run

It’s smart enough to transfer only files that have changed, which is much better than having to remember and copy them. It can also use parallel connections for extra speed.

Type help at the lftp command prompt to find out more, or check out the lftp webpage. Hope this saves you time!

Electronic ears: Using Performous to learn how to sing

SCHEDULED: 2010-07-28 Wed 08:00

I’ve been singing in the wrong key(s) all my life. Thanks to Brendon Robinson’s recommendation of Performous (a free, open source music application), I can finally work on fixing that.

Part of learning how to sing is getting used to what the notes feel like. I find it difficult to listen to piano notes and figure out if I’m singing at the right pitch. Sometimes I’m sharp, sometimes I’m flat, sometimes I’m way off. Recording is a hassle, and it takes too long between trying something and getting feedback. (I’m amazed by how my dad taught himself all sorts of photography techniques with a film camera…)

Performous provides instant feedback on the musical note and frequency it hears. I can watch the note and slide up and down the scale until I find the right pitch, and I can make up my own exercises for getting the notes right.

When I can sing scales and vocalizations without a hitch, then I can find a singing teacher to help me with volume and technique. First things first: gotta do it right before I do it loud. =)

I only wish I thought of looking for something like this a long time ago!

*Performous (*: Free and open source – Microsoft Windows, Mac OS X, Linux

Using supervisord for Nginx+FastCGI+PHP

I was having problems with spawn-fcgi-standalone occasionally resulting in dead PHP processes, which caused 502 Bad Gateway errors on my site. Crontabbing an /etc/init.d/init-fastcgi start didn’t help much, so I looked for other ways to do it. Supervisord looked promising.

Here’s how to get Supervisord:

apt-get install python-setuptools
easy_install supervisor


Here’s what to add to /etc/supervisord.conf:


So far, so good. When I kill the php process, supervisord starts it back up. Progress!

supervisord doesn’t come with an init.d script, but you can get one for Ubuntu.

Fixing SIOCSIFFLAGS: Unknown error 132 for Karmic wireless on Asus Eee 1008HA

I was having problems with wireless on the netbook-oriented version of Ubuntu Karmic Koala. ifconfig wlan0 up returned SIOCSIFFLAGS: Unknown error 132. Thanks to Ubuntu’s bug database, I found the following solution:

rmmod ath9k
rfkill block all
rfkill unblock all
modprobe ath9k
rfkill unblock all

Asus EEE 1008HA and Ubuntu: Keep a USB drive handy

I’d been thinking about getting a netbook for a while, but I’d felt guilty over the two ultraportables languishing in our electronics drawer. I occasionally dusted them off and W- even got Ubuntu running on them again, but I just didn’t use them as much as I did before I got my work laptop. Keeping multiple configurations synchronized is a pain. Lugging two laptops around is a real pain.

I held out for the longest time. I’d been into ultraportables when having an 8.9″ screen made geeks’ heads turn (which is how I got away with selling advertising on the back of my laptop one weekend, as an experiment ;) ), and now that ultraportable computers had gone mainstream, well… <laugh>

Then W- reminded me that the real reason why I haven’t been using the Fujitsu Lifebook P1110 or the Sony Vaio U1 was that I’d used them until they fell apart. Really. Masking tape was the only thing keeping the P1110 together.

And then I ran into all sorts of computing difficulties on my work laptop, and I decided that having a backup system that I could keep in a consistent configuration was worth some of my dream/experience fund. A light machine that I could use for presentations and for blog posts would be nice, and if it could let me connect to Windows-only teleconferences while continuing to do work using the Linux partition on my main laptop, that would be fantastic.

After consulting Ted Tritchew (resident guru) and a number of Net resources, I ended up with two choices: the Asus Eee 1000HE, and the Asus Eee 1008HA. The 1000HE was relatively solid, worked well with Linux, and boasted a 9.5-hour battery life. The 1008HA was slimmer, lighter, and could get by on 6 hours. I went with light, because the pounds really do add up.

It was easy to get Windows XP and Linux to co-exist, thanks to the USB installer that Ted lent me. The 1008HA was pre-partitioned, so I just installed Linux onto the second partition. (Nice not to have to fuss with resizing things!)

The first major hiccup I ran into was getting networking to work. With the default install of Ubuntu, not even wired Ethernet worked! I came across this really useful review which said:

Once you install, you need to grab the AR813X-linux-v1.0.0.8.tar.gz package from . Untar this (ignore the gzip errors), cd src, make, sudo make install, then insmod the resulting file. That should give you wired ethernet.

To get wifi, go to Administration > Software Sources > Updates and check off “Unsupported Updates (jaunty-backports)”, then do sudo apt-get install linux-backports-modules-jaunty . Once you reboot, you should have wireless.

So the important parts of my system work now, and I’ll worry about the other bits later on.