free software

Linux, open source software, tips and tricks.

ssh + netcat

1

At work, I need to access some blade servers that are on a private network. The only way to get into these machines is to shell into a lab box first, and then shell into a blade.

alan@desktop:~$ ssh root@labaccess
Last login: Tue Feb 17 10:13:52 2009 from desktop
[root@labaccess ~]# ssh root@blade3
root@blade3's password:-******
Last login: Tue Feb 17 10:14:03 2009 from labaccess
[root@blade3 ~]#

A while back, I picked up this little nugget from the TriLUG mailing list (thanks to Magnus Hedemark). There is a way to make this intermediate hop automatically. Simply add the following to $HOME/.ssh/config:

Host blade3 blade5 blade10
    ProxyCommand ssh root@labaccess "nc %h %p" 2>/dev/null

Now, when I try to ssh directly from my desktop to one of the blades, it first establishes an SSH session to the labaccess machine, and then netcat’s all of my original SSH traffic directly to the target blade.

This process will ask you for 0, 1 or 2 passwords, depending on whether your public key (from desktop) is in the $HOME/.ssh/authorized_keys files on the labaccess and bladeX machines. Since I have my public key on all of the machines, this is what I see now:

alan@desktop:~$ ssh root@blade3
Last login: Tue Feb 17 10:17:21 2009 from labaccess
[root@blade3 ~]#

This also means that I can scp files directly from my desktop to the blades, without having to dump them on the labaccess machine.

By the way, this trick provides an EXCELLENT reason to consider re-flashing your home router with Tomato firmware, which has ssh and netcat built-in.

Host homepc1 homepc2
    ProxyCommand ssh root@router "nc %h %p" 2>/dev/null

GnuCash for Windows

2

When I started a consulting company in 2006, I decided to use GnuCash for my business books, since I was already familiar with it from home use. It is very well-suited for business accounting, since it uses standard accounting terminology and double entry. When it was time to prepare my corporate taxes, I called my dad (an accountant) to explain basic business accounting to me… closing out the books for the year, and all that jazz. I really wanted to share my GnuCash file with him, but that was not possible, since he uses Windows.

Today, I discovered that GnuCash has been ported to Windows (since version 2.2.0 in August of 2007). This is HUGE. With the whole “interoperability” stumbling block out the way, small businesses have one more reason to use open source software like GnuCash and Linux. I imagine that soon, if not already, business owners will be able to send their GnuCash data files directly to their accountants, just like they do today with their QuickBooks files.

Today, in preparation for March 15th (tax day for corporations), I installed GnuCash on my dad’s Windows PC, and he took a look at my books.

GnuCash, FTW!

I do have one question, though. During the installation, the GnuCash installer mentioned something about “Installing Windows firewall rules.” That scares me a little. If you know why it does this, leave a comment below.

Let the music play!

0

My friend Tim told me about a music service called “Pandora“, which is an internet radio station that runs in a flash applet in a web browser. You can suggest songs or artists, and vote songs up or down. It uses the the Music Genome Project to categorize music, and to add similar music to your playlists. It’s a pretty cool project.

However, I encountered problems when I ran it on my Asus Eee PC 900. Pandora seems to run fine by itself, but it pauses and skips if you are browsing in another window. I think it has to do with a combination of Firefox’s “AwesomeBar” and the Eee PC’s flash disk.

The Awesomebar is Firefox3’s new address bar that searches for matches among your bookmarks and the titles and URL’s from every web site you have visited recently. Since the Eee PC uses a solid state flash disk, disk writes are pretty slow. So when you are browsing, every time open a new page, Firefox 3 writes some stuff to its sqlite database of user history. It then calls fflush(), which flushes all writes (not just its own) to the disk. During this time, all browser activity halts until the writes are complete. Other applications keep running fine, but the browser rendering stops — often “graying out”, turning back-and-white until it starts responding again. The problem is, flash applets also pause, and that includes Pandora.

I considered a few solutions:

  • Run the Pandora applet in a different browser, and use Firefox for browsing.
  • Run the Pandora applet in a stand-alone flash player.
  • Run the Pandora applet on my server, while I browse on the Eee PC.
  • Run a different application for audio, like “audacious” (an xmms clone).

Combining a couple of these ideas, I wondered if I could run some sort of console-based streaming audio application on my server. It would be cool to hook up some speakers to bender and listen to internet radio.

It turns out that mplayer will do just that. For example:

mplayer http://wunc.org/about/listen.pls

And now we’re listening to our local NPR station!

Note – you’ll also want to install a utility to set the volume. I use alsamixer.

Of course, this does not solve the original problem of Pandora pausing. And there seems to be quite a frenzy on the Firefox bug tracker about flushing the history database.

But streaming audio from a headless server is a pretty neat idea, and one that may become a permanent fixture in my home office.

USB on VirtualBox (non-OSE)

0

I spent most of Sunday trying to get a USB device to work under Windows XP, running inside of VirtualBox OSE on an Ubuntu host. I found lots of how-to’s, mostly involving permissions on /dev/bus/usb and /proc/bus/usb, and also comments about /etc/fstab. However, the part that was not inherently obvious was that VirtualBox OSE (the “Open Source Edition”) does not support USB. However, the non-OSE version does.

Again, VirtualBox OSE does not support USB.

So I downloaded the non-OSE version (actually, on Ubuntu, you can simply add a line to your apt sources file and use the normal apt tools to install it). Within minutes, my USB devices showed up. From what I understand, you do still need to make sure to mount /dev/bus/usb.

root@kimono:~$ grep vbox /etc/group
vboxusers:x:125:alan
root@kimono:~$ grep usb /etc/fstab
none  /proc/bus/usb  usbfs  devgid=125,devmode=664 0 0
root@kimono:~$ mount | grep usb
none on /proc/bus/usb type usbfs (rw,devgid=125,devmode=666)
root@kimono:~$
Go to Top