Category Archives: linux

Wireless, VNC, and the TV

So my roommate has a big screen TV. I have a laptop and a netbook. I was sitting on the couch tonight with a friend and we were looking up stuff online with my netbook. The small screen of the netbook makes it hard to share with two (or more) people. I’ve hooked up one of my computers to the TV before when I had a few people over for a study session. That was fine at the time, because I was sitting next to the TV (the HDMI cable is quite short). But tonight we both wanted to stay on the couch and control the TV from my netbook. The solution? VNC!

Both of my computers are running Ubuntu, so I set up a server on my laptop (with the x11vnc package) and the viewer on my netbook (with the xvnc4viewer package). From the netbook I ran this command:

vncviewer -listen

Then from the laptop I ran this command (with the IP address of the netbook):

x11vnc -connect 192.168.2.6

VoilĂ ! The netbook’s display (being a VNC viewer) is really laggy, but that’s okay. Also, watching YouTube on the screen doesn’t work very well because it has to stream the video AND send the screen image over the wireless to the netbook. But on the whole, a very interesting solution.

Now I can leisurely control the TV from the couch. Wirelessly. I’m such a nerd.

Linux notifications for the Kynetx KRL command-line tool

This is a response to Mike Grace’s excellent post, Growl Notifications for Kynetx KRL Command Line Tool. The idea is entirely his; I’ve just implemented a solution for Linux. I recommend you go read his post so you know what this is all about.

Since Linux uses libnotify instead of Growl, it’s fairly simple to implement as similar solution to Mike’s on a Linux system.

You’ll need the libnotify-bin package installed. You can do that in the normal manner.

First, add the following to your ~/.bashrc file:

krl() {
  if [[ $1 == "commit" ]]; then
    command krl $@ | tee status.txt
    notify-send -i ~/.kynetx-x.png “KRL” “`cat status.txt`”
    rm status.txt
  else
    command krl $@
  fi;
}

This is basically creating a function that will run whenever you issue the “krl commit” command. It pipes the output of the KRL gem to a file and then uses the text of that file in the notification.

You can download the Kynetx “X” image to your home directory if you like with the following command:

curl https://kynetx-apps.s3.amazonaws.com/krl-commit-growl-notify/kynetx-x.png > ~/.kynetx-x.png

That’s it! Have fun!

Setting up a passwordless login over SSH

Here’s how you can set up a public key to allow you to login to a remote server over SSH without a password. (I draw mainly on the instructions here.)

First, open a terminal on your machine. We’ll call it mybox. We’re going to create a public key.

[me@mybox ~]$ ssh-keygen -t rsa

This will ask you first where you want to save the public key you’re creating. (The default location ~/.ssh/id_rsa is fine.) It will then ask you for a passphrase. You can just press enter twice at those prompts to skip the passphrase (I always have).

Now make sure there is a .ssh directory in the home folder on the server where you want to log in (we’ll call it myserver):

[me@mybox ~]$ ssh me@myserver mkdir -p .ssh

Next we’ll append the public key from mybox to the authorized_keys list on myserver:

[me@mybox ~]$ cat .ssh/id_rsa.pub | ssh me@myserver ‘cat >> .ssh/authorized_keys’
(Note that those are single quotes, not backquotes.)

That’s it. You can test it with any command that uses an ssh tunnel (ssh or even svn or git, for example). Also note that you can use this same public key to set up passwordless login on any machine you like.

Now another handy thing is adding preconfigured setups to your ssh config file. It’s located in ~/.ssh/config. Here’s an example setup:

host server
    Hostname myserver
    User me

(See this reference for explanation on all the possible parameters you can use.)

Now you can type ssh server on the command line and get logged right in–no need to specify your username or enter a password.

Now mind you, this could potentially be a dangerous setup. Only use this on a well-secured computer where you are the only person with access to your terminal. Any hacker that gets in to your machine can now log in as you to myserver without having to know your username or password. Convenience comes at a price.

Installing Ubuntu in a dual-boot configuration

Ubuntu Circle of FriendsI’ve installed Ubuntu several times on various machines in a dual-boot format, but I’ve never blogged about it. In all cases, it’s been with Windows on the first partition (mostly with XP, but also once with Vista on a new machine), so I’ll use that as my example here.

First things first. Get Windows ready. This usually includes defragmenting to get all your files at the beginning of the partition. That’s pretty much it.

Next, get the install CD (from Ubuntu or your favorite distribution).

Boot into the installation CD. Ubuntu comes with a partition editor (GParted) on the CD, which you’ll need soon.

Resize your Windows partition in order to leave enough space for (a) the linux system itself, (b) a swap partition if your RAM isn’t plentiful, and (c) any other shared partitions you may want to make:

  • (a) In the case of Ubuntu, the minimum hard drive space required is 4 GB, although in my experience at least 10-15 GB is better. This partition will probably be of type ext4 (at least, it is in the latest version of Ubuntu)
  • (b) Depending on how much RAM you have and how much hard disk space is available, you may want to add a swap partition. This is a sort of paging file used to swap out segments of the RAM that aren’t used very often, freeing up memory for more active applications. On my old machine, which has 512 MB RAM, I added a 1 GB swap partition. On my current machine with 4 GB RAM, I don’t have any swap space at all and everything runs fine. It’s up to you.
  • (c) If you want to be able to share files between Windows and linux (and haven’t yet converted to a cooler solution like Dropbox), it might be wise to make a FAT32 partition that can be read by both operating systems. Make this one however large you need.

Be sure to tell the partition editor that you’re going to want to put the root file system (/) on your ext4 partition, and ensure that your swap partition (if you made one) is correctly identified as such.

If you’ve made it this far, you’re almost done. Now run the installer and let it work its magic.

Ubuntu’s always installed GRUB without a hitch. But if you do run into trouble, this documentation from Ubuntu is a good place to look.

Congratulations, and welcome to linux!

Microsoft patent infringements and Linux

The latest buzz in the Linux forums deals with Microsoft’s claims on patent infringements. Novell made a deal with Microsoft last year dealing with interoperability between Linux and Windows. Word has it that Red Hat is now following suit, despite previous resistance, and making plans to talk to Microsoft.The part that baffles me is how Microsoft is claiming that open-source software is infringing on its patent rights, even though it may be that Microsoft has violated some open-source patents.

Now it seems the Free Software Foundation has made a blunder with the new GPLv3. It makes me wonder if the open-source community will leave the FSF in the dust or if they will submit to the new terms. Linus Torvalds, at least, has said that they don’t anticipate moving the Linux kernel to the new GPL.

What a mess.

On the brighter side, Apple’s stock is skyrocketing since the iPhone came out last week.

Vim and how to write a worm

Being the computer geek I am, I found a few articles that are intriguing to the geeky mind.

On July 26, 1989, Robert Morris, a student at Cornell, was indicted for releasing the Morris worm. This computer worm, one of the first ever created, played on several UNIX security vulnerabilities and infected thousands of computers once it was released. I found an article by University of Utah professor Donn Seeley, which describes how the worm was built. It was a fascinating read.

I also came across a few articles on Vim, my favorite command-line text editor. It can do amazing things. This website discusses using Vim efficiently, working with multiple files, and customizing the vimrc file. I’m putting these links here mostly for my own benefit, but perhaps someone out there shares my love for Vim…

Xfce desktop environment

screenshot2.pngI started using the Xfce desktop environment under Ubuntu the other day and have loved it so far. GNOME is a bit too heavyweight for me, so I’ve been using Fluxbox for a few months. It’s lightning fast and really slick, but there’s no eye candy whatsoever.

So the other day I decided to download Xfce and try it out. It looks quite similar to GNOME but runs a lot faster. It’s much easier to customize than fluxbox and it supports my keyboard metakeys much better. Plus the eye candy is great without taking too much toll on the speed. I really like the themes, too. (There are even some windows-esque ones.) And everything runs just as well or better under Xfce as it did under fluxbox.

Another cool feature is the ability to create multiple “sessions” or startup profiles. You can set Xfce to prompt you for which session you want when you log in. So I can create one for play, one for work, and one with nothing special.

So there you have some ramblings about the wonders of Xfce.

Ubuntu Studio

screenshot-1.pngI helped my friend install Ubuntu Studio on his laptop yesterday and today. It’s pretty cool, I must say. Being a huge linux fan, I’m really excited for him. Ubuntu Studio has a ton of open-source multimedia authoring and editing software. And a really sweet theme (pictured at right).

We ran into some issues while installing but were able to resolve them fairly easily. Here’s a summary and some tips for anyone that may be having the same problems:

  • He first installed 6.06 because that was the only CD version he had. Since it was a fresh install, he didn’t have any trouble upgrading to 6.10 and then to 7.04 (besides a slow connection).
  • Once the full 7.04 system was installed, we followed the instructions on The Ubustu Feed to install the Ubuntu Studio packages on top. We had to make sure the “universe” repository was selected, as we were getting “<package name> is not installable” messages.
  • His screen resolution was less than optimal (1024×768 on a widescreen laptop made for 1280×800). But he has an Intel graphics card, so we resolved it using the 915resolution package and these instructions.

rm -rf

Just a note to you UNIX users out there. rm -rf is a dangerous command. I’ve been warned from so many sources I don’t remember them all, but I still manage to use it somehow. Today I deleted a whole directory of image files on a project at work. (Luckily I had a backup from yesterday, so it was just fine.) But the point remains: Be careful using rm -rf!

I’ve made an alias in my .bashrc file that says rm='rm -i', just so it will make me confirm things in case I actually wasn’t paying attention. (Obviously using -f overrides that, which is convenient when deleting directories but very dangerous at the same time.)

Be careful with sudo, too…

Ubuntu

I’ve been using Ubuntu Linux for nine months now and have enjoyed it immensely. I’m a computer geek anyway, so linux is the perfect toy for me. I love the customizability and control linux gives me. I can open up a bash shell and do most of my work from there. In fact, for the last several months I’ve been using the Fluxbox window manager. It provides very few graphical utilities, so I do most of my work from the command line.

Aside from the terminal, my favorite thing about linux in general and Ubuntu specifically is all the open source software that is available for it. Everything running on the box right now is free/open source software. It is awesome to watch how the open source community has made such great products.

Simply because of the way linux and other unixes (like Mac OS X) are built, viruses and spyware are generally not a concern. Security is much easier to maintain. I don’t even have any antivirus software on this box and have never had a problem.

One perpetual issue with linux is hardware support. The built-in wireless card on my Compaq Presario laptop has never worked reliably, despite my earnest efforts. But by and large, the default installation of Ubuntu 6.06 (the first version I used) found most of my hardware and made it work sufficiently well. I’m using 7.04 now, and it all still runs great.

So as I was surfing today I found a few interesting items:

  • Ubuntu Studio is an Ubuntu derivative targeted toward the multimedia guru. Their first official release has just come out, based on Ubuntu 7.04. I have a friend who is really into video and audio editing, but most of the software he uses is written only for Windows (except for The GIMP, of course!). This is a step in the right direction for linux to enter this market. These blogs discuss Ubuntu Studio and may be of interest:

    EDIT: I also found the following two sites:

  • Dell is offering Ubuntu pre-installed on new systems This is another exciting step for linux entering the general consumer market. Linux has long been the domain of the computer geek, but Ubuntu especially has made great progress in making linux accessible to the average human being.