Muffinresearch Labs by Stuart Colville

MacFUSE: sshfs for your mac | Comments (5)

Posted in Apple, Linux/Unix on 19th January 2007, 12:41 am by Stuart

MacFUSE is a implementation of FUSE (File-system in USErspace) that is provided via a kernel extension.

So what is FUSE?

FUSE provides a easy way for anyone to create their own filesystem through providing hooks into the kernel. A list of FUSE filesystems tested with MacFUSE is provided on the wiki. One of most well known FUSE filesystems is SSHFS (A filesystem that runs over SSH + SFTP) so we’ll use that as an example of MacFUSE in action.

Installing MacFUSE

The easiest way to get macfuse running on your mac is to go and grab the dmg that contains an installer that will install the kernel extension and required libraries. The package is available here on code.google.com. After installation you will need to restart your machine.

UPDATE: The most recent versions bundle sshfs as a separate download. If you want to install sshfs then you need to install the MacFUSE core as above and then install the separate sshfs package. The main difference is that if you want to use the comand line version as described below you need to symlink to the sshfs binary in the sshfs.app that you will have dropped into your applications directory. To do this simply type: sudo ln -s /Applications/sshfs.app/Contents/Resources/sshfs-static /usr/local/bin/sshfs Note if you have a sshfs binary already installed it’s recommend you do use the symlink so that you are using an up to date version of the sshfs binary. As the gets updated so will your binary. (I would suggest renaming the old binary first before creating the symlink).

Currently it’s necessary to make sure that /usr/local/bin is in your path. To check this open terminal and type echo $PATH. If /usr/local/bin isn’t in the output of that command you will need to add it into your .bashrc file. Open/create .bashrc with your favorite command line text editor and add a line like this:

export PATH=$PATH:/usr/local/bin/

To pickup the changes simply close and reopen terminal or run the following command:

. ~/.bashrc

Testing MacFUSE

To make sure macfuse is working we can mount a remote server via SSHFS. To do this you’ll need a remote server with SSH and the SFTP extension installed.

The command to run sshfs to mount a server filesystem is as follows:

mkdir /mountpath
sshfs user@server:/remotedirectory/ /mountpath -oping_diskarb,volname=volumename

Replace “remotedirectory” with the directory on the remote server you want to mount and “mountpath” with the directory on your mac to use as a mount point. Replace volname with the name you want to use to represent the volume as in finder.

If it’s worked you should see the volume show up in the finder. If not and you see a message like, “Remote system disconnected” then try running the same command again with this debug switch after sshfs:

-o sshfs_debug

In some cases if there’s any problems relating to the connection this might help.

To unmount the filesystem simply eject the volume in Finder, or run umount /mountpath

Post Tools

Comments: Add yours

1. On February 14th, 2007 at 5:00 pm Chris Blow said:

Sorry to be a bother if this is a stupid questions, but why might I want to do this? I mean what applications are there, and what advantages?

2. On February 24th, 2007 at 9:28 pm Toontje said:

Thanks for the debug option explanation!

3. On March 27th, 2007 at 5:10 pm Matthew said:

@Chris: If you have to ask, you probably don’t need it.

I like MacFUSE and sshfs a lot, except that I have a serious problem if my username isn’t the same on the remote system. I mounted a remote file system with the appropriate username/password for that server, and was able to read all the files…but whenever I tried to write to one, it said permission was denied. Very irritating, and I haven’t found a way around it.

4. On August 5th, 2007 at 1:16 am Larry said:

I had the same problem as Matthew. The defaults of sshfs dont have the mapping correct if your remote vs local uids are not aligned. Same goes as well with user names.
The option is to add the -o idmap=user.

5. On August 5th, 2007 at 1:19 am Larry said:

To answer Chris’s question.
Being able to work on the remote files from your local
workstation with local tools and not have to move them back
and forth with scp/rsync or some other transfer tool.
This makes them look just like something local. Nice way
to work on your remote web site if you have ssh access.







XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>



Standalone mac battery charger|(0)

Got a spare mac battery? I’ve often wondered why up until now no-one’s produced a standalone charger so that you can charge batteries without having to plug them into the mac. Fortunately Fastmac.com have produced a standalone charger that allows you to do just that. and it’s compatible with iBooks, Powerbooks, macbooks and Macbook Pros. It’s also 110/200v. Exactly what I was looking for!

Django Admin Ominigraffle Stencil|(0)

Colleague Alex Lee has created a nice stencil for omingraffle with the Django Admin UI components, perfect for wireframing customised admin screens. For more details and to download the stencil see Alex’s Blog csensedesign.co.uk

Photos on Flickr

© Copyright 2004-08 Stuart Colville, all rights reserved. May contain traces of Muffin. Powered by WordPress. Hosting by 1&1 This page was baked in 0.721s.