# Shfs?



## lackluster (Jan 7, 2005)

Hello, all. I'm new to Macs, newer to OS X, and recently started trying to follow the XCode tutorials. Now that you know me on to my question(s) . I love this little app shfs (http://shfs.sf.net). Maybe you've heard of it? It allows you to mount (via mount -t shfs server:/shared /mnt/server) a filesystem over ssh. Very cool, and the source is pretty small and readable. 

Two questions result from this:

1.) Is there anything like this for OS X?

2.) Failing 1.), what is the equivilent of a kernel module in OS X, or would I even need one to write a mount-extension?

Thanks


----------



## Pengu (Jan 7, 2005)

um.. you can already mount AFP over SSH... what protocol does it use inside the SSH tunnel?


----------



## lackluster (Jan 8, 2005)

Sorry, I neglected to mention that the other computers are running linux, as I'm much to poor to afford all the sleek mac stuff. Consequently, there is no AFP (or I'm not aware of / using it). As for the protocol over the ssh tunnel (I assume you mean that shfs uses?), I was under the assumption that all mount extensions provide an interface between mount and the target filesystem. In the case of shfs I venture further to assume it's reading/writing files much the same way sftp does.


----------



## scruffy (Jan 9, 2005)

There is not protocol under the ssh - that's the point, it just uses a plain shell connection.  It doesn't do exactly the same as sftp either.  The FAQ says it has two modes of operation - a shell, or perl - so presumably, it just runs a bunch of "cd here; ls-l ; cat > file" type operations over the ssh tunnel (in the shell mode.  Presumably a similar thing under perl).

Unfortunately, OS X doesn't support mounts file systems via sftp/ssh.  Doesn't even mount webdav over https, or read/write mounting ftp servers.  All of which it really should do...


----------



## lackluster (Jan 9, 2005)

Scruffy, thanks for the reply, but under which FAQ are you referering? Also, what do you mean there is no protocol under ssh? Do you mean SSH itself has no protocol (obviously it does) or shfs does not seem to run protocol over the ssh tunnel?

So what is the OS X equivalent of kernel modules then? A link would be great .


----------



## Darkshadow (Jan 9, 2005)

Kernel extensions (bundles end with .kext).  And no, ssh doesn't _have_ a protocol.  It's just a way to connect.  It _is_ a protocol.  What you do with it can vary.

webdav over https doesn't work because Apple's mount_webdav doesn't do encryption/decryption.  mount_webdav _also_ won't work with any port other than the default 80. I tried setting up my apache server to do it with a different port and failed miserably.  It should probably work in that case, too.


----------



## scruffy (Jan 9, 2005)

The faq I was reading was off the shfs site you linked to.

Yes, you understood me correctly, even if I wasn't very clear - I meant that no additional file sharing protocol (such as NFS, AFP, WebDAV or whatever) is tunneled over the ssh connection - just straight shell commands.


----------



## Pengu (Jan 9, 2005)

Ok.. i wasn't saying before, that SSH IMPLIES the use of AFP/etc.. I was saying that AFP has the option for using SSH to encrypt connections (in the "options" section of the "connect to server" dialog)


----------



## lackluster (Jan 10, 2005)

> And no, ssh doesn't have a protocol. It's just a way to connect. It is a protocol. What you do with it can vary.



A subtle, but important difference.

Thanks all for the info. So it seems there is currently no way to mount a share over ssh (besides AFP, and I believe I'd read NFS?) in OS X, and if I wish to pursue the matter then kernel extensions are the way to go.


----------



## scruffy (Jan 12, 2005)

One thing you could do: 

If you can have WebDAV running on the server machine, you could build your own ssh tunnel from port 80 on the Mac (apparently OS X doesn't support DAV connections to a port other than 80; thanks Darkshadow) to whatever port the server is listening on (typically 80 again), on the remote machine.  Then you could try making a WebDAV connection to http://localhost.  This would be forwarded over the ssh tunnel to port 80 on the server.

The big limitation to this, would be that you couldn't connect to more than one server at a time, since you can only forward port 80 to one place at a time; and you obviously couldn't have a web server running on the client either.

You'd have to run the ssh command as root on the client, since only root can grab port 80, but you could log on as any user on the server.

sudo ssh -L 80:localhost:80 -N remoteuser@server

would do it.


----------

