Skip to content

Blog

MacFUSE and SSHFS

One of the things I love about KDE, my primary Linux desktop environment, is a technology called KIOSlaves. When you’re using it to connect to a remote server over SSH with SFTP for example, all your KDE applications can access files on that remote system exactly as if it was a local disk.

Now that I’m using Mac OS X a fair bit of the time too, I wanted to duplicate this kind of functionality (using OS X’s native applications and not KDE ones running under the operating system).

Thankfully, MacFUSE and SSHFS solve this problem, by allowing you to mount a remote server (using SSH file transfer) as a volume in the Finder. Just like with KIOSlaves, all your Mac apps (and even non-native ones) can read and write over the network as if it was a local file.

So, here’s a quick primer on how to install it.

Head over to the MacFUSE Google Code page and go ahead and download the MacFUSE Core package (at the time of writing, version 0.2.2).

Open up the disk image and run the installer by double-clicking the pkg file.

MacFUSE DMG

You will need to reboot after installation, as MacFUSE adds a kernel extension (don’t worry though, it’s all free/open source under the BSD licence so there should be no nasty stuff, hopefully).

Once you’ve rebooted, head back to the Google Code page and go to downloads. Grab yourself the latest version of sshfs (right now, that’s 0.1.0).

Once again, open up the disk image. This time, just drag the application to your /Applications folder (or wherever you want).

Now, run the application and fill in your details. Click Connect and a couple of seconds later, you’ll need to enter your password (or key passphrase). Finally, your mounted SSH drive should appear on the desktop and in the Finder (make sure your Finder preferences are set to show ‘Connected servers’).

SSHFS window

And that’s it! You can hack away over SSH with full application integration. When you’re done, simply eject the network drive like you would any other and you will be safely disconnected.

It’s actually really awesome – and surprisingly easy. A couple of caveats you need to be aware of, however:

  • While this doesn’t happen for me, you might end up accidentally planting loads of OS X metadata all over your remote filesystem. As I say, I don’t experience this behaviour in the many times I’ve used it, but beware of this possibility before your friends start asking you why you’ve just littered every directory with a .DS_Store file. :P
  • File sizes are not reported correctly by sshfs. Do not believe what it says.
  • If you run SSH on a non-standard port for anti-cracker reasons (very good idea, by the way), the GUI client to connect won’t work. However, you can use the command line client to initiate the connection. From there on, it works just as advertised.
  • All of this is pre-release software. Worked for me, but YMMV.

It’s awesome, though. :D

Backing up your Mac’s /Users folder

Just finishing off my first ever backup of my MacBook. I’ve made a complete copy of the /Users folder, which should back up all the files and preferences of all the users on the computer.

Just for reference, and to show how I’m doing it, I’ll walk you through how I’m doing my backup.

I’m backing up to an external 200 GB hard drive, onto a partition formatted with NTFS. Thanks to MacFUSE and the NTFS 3G projects, I can safely write to the drive easily. I’m not going to cover how to install them here, so I’ll just assume you’re using some kind of external storage already set up for writing use on your Mac.

Now, we could just copy the files onto the storage medium in the Finder, but unless your removable disk is formatted with OS X’s native file system, you’ll lose Mac-specific metadata. While that’s not usually vital, it’s always better to preserve the original information and for that reason we’re going to make a disk image file (yes, like those .dmg files you download) in which to store our backups. Storing the files inside the DMG makes a mini filesystem-in-a-file which is formatted with HFS+ (the native format), so we keep all that extra information.

» Read the rest of this post…

Taking Ajax further with PHP

Peter's WebDev Workshop

First of all, I have to apologise. It’s been literally two months since my last post in this series, and it’s been more than that since I last looked at Ajax in PHP. OK, I might admit it, it was this comment that motivated me to pick up this series again. Oh, that and I’m now on the half term break, so I’m finally getting round to some things that have been on the back burner for a long time.

In our last Ajax tutorial, we got started with Ajax using PHP and made our first Ajax application.

Today, we’re going to take Ajax a little further, by building a little application where our user selects a product from a pop-up list, and then we do a little Ajax dance to get some product details (and an image) and display them in a box below. We’ll be making our own little XML schema which we’ll use to pass information between the JavaScript in the user’s browser and our PHP script on the server.

» Read the rest of this post…

OOP in PHP – Part 1

Peter's WebDev Workshop

Apologies. It’s been literally months since I did my last tutorial here. Most of my tutorial effort has been focused on FOSSwire. Anyway, I’m back now and thanks to a request from Nick I’m starting a new multi-part tutorial today.

Now this has been covered in many places before and the subject is object-oriented programming (OOP) in PHP. For the purposes of this tutorial, I’m using PHP 5.1.6 on Linux, but all of this should work on PHP 5.x on any platform and most of it will work in PHP 4.x.

» Read the rest of this post…

Hacking Firefox 1.5 extensions for 2.0

One of the bad things about upgrading to a new Firefox major version is that inevitably, some of your favourite extensions won’t be modified to work with the new version. And with Firefox extensions being so awesome (and arguably crucial to Firefox’s success)…

But, thankfully, it’s not too difficult to hack the extension files to make your extensions work with the new version.

Before I begin – this process could make your extension (and maybe your Firefox profile too) not work – so do it at your own risk! Having said that, starting Firefox in Safe Mode and uninstalling the culprit extension usually fixes any extension issues that may arise.

I’ll be using BoxCheck for this tutorial.

» Read the rest of this post…

Recording screen demos with pyvnc2swf on Windows

I did it for (Ubuntu) Linux and now it’s the turn of Windows to get some screen recording love with pyvnc2swf. The installation procedure on Windows is also fairly simple, but unfortunately because Windows doesn’t ship with Python (unlike well, say, Linux and Mac OS X and most other Unix systems) we have to install that first.

So without any further ado, we’ll get going.

» Read the rest of this post…

Installing WPGet – video tutorial

You didn’t ask for it… but you got it anyway.

If you’ve been wondering exactly how to install WPGet, you need wonder no more, as I’ve done a screencast with a quick demo installation of WordPress.

This should serve any installation queries until the next version of the Config Tool arrives, which will feature one-click configuration (you will be able to download the fully ready-to-go script without any copying and pasting).

So, get watching!

A few notes:

  • The reason the download in the video took so long is because for some reason the DNS servers over here are being really slow this evening, meaning it takes almost 15 seconds to visit most web pages (every time it does a lookup). Grrrrr…
  • Needless to say, the database password (and relevant details) you may or may not have seen in the demo don’t work anymore. :P
  • Fellow KDE users may ask why I was copying things around and not working off the server directly (I love that feature in KDE). The reason is, most people won’t have that ability or won’t be used to that way of working, so I copied and pasted my way around instead.

Recording screen demos on (Ubuntu) Linux

You may well have recently read my glee at getting a decent screen recording solution for Linux running and working, and this tutorial on how to get it to work for you has been brewing for a while now.

However, this solution is not just for Linux. It’s actually cross-platform and works across the big three main operating systems and should work on other Unix systems with little changes. Don’t worry, the Windows tutorial is coming up soon!

(Quick note – there are a couple of issues that I haven’t ironed out yet in this tutorial, but I wanted to get it out on my site sooner rather than later. They don’t affect installation, but I can’t seem to get recording in Ubuntu yet. It’s still worth running through the install, however, and rest assured I am working on the problems and will get them fixed as soon as I can!) All fixed!

This is also the first tutorial to be brought to you courtesy of my fresh new Ubuntu installation, just for doing tutorials (so I don’t have to uninstall and reinstall everything from my main machine where it’s working nicely, and of course for Ubuntu specific stuff).

OK, let’s go!

» Read the rest of this post…

I like vnc2swf – oh, and a quick screencast for you

Finally found a decent video screen capture solution for Linux (well, actually it’s cross-platform but that’s even better). It’s called pyvnc2swf and hopefully it will allow me to augment my future tutorials with video and audio.

So to test it out, here is a quick demo of killing processes, tying in with my recent tutorial on the subject.

Don’t worry, I’ll reveal all on how to set up pyvnc2swf with audio and all that stuff in due course.

Watch it here.

(While I can get KDE running in my recording VNC system by running killall twm;startkde, I can’t seem to find the command for Gnome, and it would be great to offer cross-desktop screen demos. Someone tell me how! Please…)

Killing misbehaving programs and processes

Beginner's Linux

It’s time for another quick Beginner’s Linux!

I’d love to say it doesn’t happen on Linux, but very rarely it does. I can say it happens less often than on Windows, though. What am I talking about? Programs and processes misbehaving – locking up, stopping working and generally causing a problem.

The problem on Windows is that if this happens, there’s no sure fire way to just nuke the offending app from your running processes. Yes, you can use Task Manager and close the process, but if that doesn’t work, well… (bad memories here).

On Linux, if this situation does occur, you have a couple of wonderful programs called kill and killall that are invaluable for killing things when they go wrong (saves many a restart of the whole system).

This is going to be quite a quick tutorial, partly because the subject matter doesn’t take that much time to cover and partly because I’m starting to get quite a lot of work I have to do, which means I’m going have to be a bit brief. Anyway, onto the tutorial…

» Read the rest of this post…