X11 forwarding over SSH

November 10, 2009

Building a Linux server is a fairly simple affair. If you’re anything like me, you had some old hardware lying around which you shoved into a cheap case, stuck a copy of Debian/Ubuntu/Fedora/Whatever on it, and bob’s your uncle.

But once it’s up and running, should you dedicate a monitor/keyboard/mouse to a computer you barely use? Or is there another option?

Thankfully, one thing Linux has in spades is Options.

Today I’m going to deal with X11 forwarding over SSH. As you may know, SSH is one of the primary ways of connecting in to your Linux server, but it’s normally used for terminal commands – something some people aren’t all that comfortable with.

X11 forwarding over SSH allows the display of any programs you’d normally run from within a Gnome or KDE session to be displayed remotely, with only a few steps to make it possible.

Requirements.

First up, you’ll need an SSH client for your current machine. If you’re using Windows, the best option in my opinion is PuTTY, as it’s free and easy to use. On Mac, your SSH client comes built in, and is called ssh.

Next, we’ll need an X server. Windows-wise, there are a couple of options such as XWin32 (commercial software) and XMing (freeware). As I’m a cheapskate, I’m going with XMing. Again, Mac users have this preloaded providing you installed X11 when you installed OSX.

Windows Howto.

So, first step. Install PuTTY and fire it up. You should see a window like this:

putty1

The Host Name or IP Address field is the important one here. Enter the name or IP address of your Linux computer. Leave the port at 22 (unless you’ve changed the default SSH port), then click on SSH in the tree on the left hand side.

Turn on compression to speed up your connection, and bring Blowfish to the top of the list. Blowfish is still relatively secure, but will be a heck of a lot quicker than AES at passing information as your computer doesn’t have to encrypt things so heavily.

putty2

Next, click on X11, and turn on “enable X11 forwarding.” You can also modify the display number if you intend to have multiple machines displaying at once, but I usually leave it as default (display 0).

putty3

Finally, let’s go back to the session option at the top of the tree and save our session so we don’t have to type this stuff in every time. I’ll call this connection ‘mycomputer’ and press save down the bottom. Then it’ll appear in the bottom window next time I start PuTTY.

putty4

Ok, go ahead and click the Open button in the bottom right corner to connect to your machine. You’ll be greeted with a username/password prompt. Use your standard user login, though – as root logins over any remote connection are a serious no-no.

putty5

Good, so we’re now connected via SSH and X11 forwarding is enabled. But we can’t run anything just yet, as we don’t have a local X server to display the information we’re after.

So after installing XMing, I’m going to start it using XLaunch, which can be found in your start menu. There are essentially two main options for us to use. First, we can use multiple windows, which will allow us to run single programs within Windows, kind of like VMWare’s Unity functionality. We’ll try that one first.

xlaunch1

The next screen gives us the option to start a client, which essentially we’ve already done with PuTTY. You can select another option, which will use an embedded version of PuTTY to connect to the remote machine transparently and fire off a command, but that’s a howto for another day. For now, we’ll leave it off.

xlaunch2

Next up is some advanced stuff about font servers which we won’t worry about at this stage.

xlaunch3

And finally the option to save your connection as and .xlaunch file should you want to run it again in the future. Save if you want to, then hit ‘finish’.

xlaunch4

Once you do, it’ll disappear and you’ll notice a new X logo in your task tray. This means that the X server is now running and ready to accept commands. Go back to PuTTY and we’ll give it one. In PuTTY, I’ll type ‘firefox &’ – the ampersand breaks the process off and lets it run on its own so we can continue using the terminal.

x1

Holy cow, Batman! Remote Firefox!

So running one program at a time is fine, but what happens if we want a full desktop? First thing we’ll do is close our current XMing session by exiting any open programs, right clicking on the X in the tasktray and selecting ‘exit.’ Then we’ll fire up XLaunch again to select a different X server layout.

I’m going to choose ’single window,’ as I prefer to have remote sessions locked a way somewhat.

xlaunch5

Hit next all the way through and press finish. You’ll be greeted with an ugly gray crosshatched window.

x2

That’s what an X server looks like when it’s not rendering anything, so there’s no need to panic. But let’s put something up there to cover the blandness.

Back in PuTTY, type ‘gnome-session &’ if you’re a Gnome user, or ‘kde-session &’ if you’re a KDE person. It’ll send a command off to your other computer that it’s to launch your main desktop environment, and after a moment it’ll display like this.

x3

So that’s the ins and outs of connecting to your Linux machine via a seamless X11 forwarded session.

Mac Howto.

Oh, if you’re a Mac user, I probably should tell you how things are done. It’s pretty difficult, so maybe you should all go grab your security blankey right away.

First, open up a terminal session by browsing to your applications folder, then the utilities folder, and clicking on Terminal.

Type the following command:

ssh your.server.ip.address -XC

The X enables X11 forwarding, and the C enables compression.

Once you log in, all you need to do is fire off some commands like ‘firefox &’ and you’re away. Easy, huh?

Remotely possible?

The last thing I’d like to note is that this option is also quite possible over a remote connection (say, from the office so your boss doesn’t know what you’re  browsing). All you need to do is set up some port forwarding on your router and point port 22 at the IP address of your Linux server. Then from the office, fire up PuTTY and enter the public IP address of your internet connection.
Enjoy!


test

November 10, 2009

This is a test post

archastro


Hello world!

November 10, 2009

Welcome to WordPress.com. This is your first post. Edit or delete it and start blogging!


Snow Leopard on Non-Apple Hardware

November 7, 2009

Building a hackintosh, an Apple computer which uses off-the-shelf hardware, can be a pretty daunting task. In the past I’ve struggled with confusing walk-throughs, been frustrated with shitty custom builds of OSX and generally thrown in the towel after about 4 hours of abject failure.

But all that changed when I found this article.

All you’ll need is something reasonably modern – in my case it was the following hardware:

  • Gigabyte X48-DS4 Motherboard
  • Intel Core 2 Duo 3.2GHz
  • 4Gb of DDR2-800 RAM
  • Samsung F1 Spinpoint 1Tb

I also didn’t have a large enough USB memory stick, so instead I used an 80Gb 2.5″ hard disk and an IDE to USB adaptor. If your motherboard is able to boot from a USB key, it should be able to boot from one of these too.

Following the guide is relatively easy, but there is one step which was missed (at least in my case), and that’s the installation of Chameleon on your hard disk once you’ve finished the install. Unless you want to keep your USB key permanently plugged in to your system, I’d suggest you go through the boot installer steps again once you’ve finished and use the ID of your main hard disk.

Enjoy!


Dr. StrangeRAID, or, how I learned to stop worrying and love ZFS

October 14, 2009

So now that we’ve chosen to go with Solaris and use NFS for our filesystem, let’s consider how we’re going to use ZFS to best suit our needs.

So let’s say that I have four 1Tb disks lying around which I want to thow into my new file server. At some point in the future, I’d like to upgrade my capacity by replacing one or all of the disks with larger ones (say, 2Tb).

How do we go about it?

Read the rest of this entry »


Upgrading OpenSolaris to the latest Dev version

October 11, 2009

At the time of writing, the release buid version of OpenSolaris is 111b, and the latest dev build is 124.

To upgrade, open a terminal and run the following commands:

user@opensolaris:~$ pfexec su -
root@opensolaris:~# pkg set-publisher -O http://pkg.opensolaris.org/dev opensolaris.org
root@opensolaris:~# pkg image-update

Expanding your OpenSolaris NAS

October 11, 2009

After yesterday’s guide on setting up a Solaris NAS, I figure the next logical questions would be:

  • How do I change out disks which have failed?
  • How do I change out smaller disks for larger ones?
  • Can I add more disks to my pool?

All three questions are quite easily answered, and can, for the most part, be done with a single tool.

Read the rest of this entry »


Home NAS with OpenSolaris

October 9, 2009

After a few requests, I’ve decided to put together a simple howto for building a home NAS with Opensolaris.

The main reasons to choose Opensolaris are simple:
* Common PC hardware is all you need. No propriatary disk bay system.
* Gigabit Ethernet. Well, providing your network card and switch support it.
* Cheap, redundant disk arrays with ZFS, the Opensolaris RAID-like filesystem.
* Quick and easy setup.

In a nutshell, it’s cheap, it’s easy, and it’s simple. So on the upside you won’t need to spend a great deal of cash to get yourself a nice NAS, but you might miss out on a feature or two. Read the rest of this entry »


Hmm. Time for a redesign?

May 29, 2009

Perhaps it’s just that I’m tired of the old look. Perhaps it’s that I’ve been influenced by some of the awesome typographic sites out there on the net. Perhaps I’ve watched the film “Helvetica” one too many times.

But I think it’s time I re-kerjiggered this joint. Any suggestions?


Iphone screenshot howto

May 28, 2009

Taking a screenshot on your iPhone is a pretty simple affair, and doesn’t actually require a special app to make it happen.

Simply press and hold the lock button, then tap the home button. The screen will flash, a camera shutter noise will be played, and your new screenshot will be dropped in your camera roll.

Enjoy!