using sshfs to share home directory

gsibley

Bit poster
Hi all,

I'm running ubuntu as a guest OS from OSX. I've been using sshfs to mount my OSX home dir so that my linux and osx home dirs are one and the same. It's pretty easy and it works great, but to use sshfs from the guest os I *have* to know the ip address of the host os.

How can I get my hands on the hosting machines IP address?

Does anybody have good ideas about mounting their host OSX home dir from the guest linux?

Thx,
sibs
 
In OS X you can use a terminal and run ipconfig -a. Or if you're a mouse kind of guy you can open the System Preferences object, open the network object, click on the tcp/ip button and read the results. If you are not using dhcp (and there are a stunning number of reasons why you would be better off doing this) you can create host table entries for both systems. You get a very stabile environment out of it that has a very low astonishment factor.

dp
 
gsibley said:
Hi all,

I'm running ubuntu as a guest OS from OSX. I've been using sshfs to mount my OSX home dir so that my linux and osx home dirs are one and the same. It's pretty easy and it works great, but to use sshfs from the guest os I *have* to know the ip address of the host os.

How can I get my hands on the hosting machines IP address?

Does anybody have good ideas about mounting their host OSX home dir from the guest linux?

Thx,
sibs

I didn't know about sshfs but that's brilliant. Thanks for the tip.

Regarding the guest OS obtaining the host machine's IP address, install the libnss-mdns package and add mdns to your /etc/nsswitch.conf for hosts. It will look something like this.

hosts: files dns mdns4

Then SSH from the guest OS to the host OS by using the Bonjour address "host.local". Substitute your real Mac hostname for host, of course. I have "Loki.local". That should work for sshfs as well.

You can also install avahi-daemon and then your Linux guest OS will appear on the Bonjour lists under the Macintosh, so you can ssh to "guest.local" from Terminal. Very cool.
 
nhand42 said:
I didn't know about sshfs but that's brilliant. Thanks for the tip.

Regarding the guest OS obtaining the host machine's IP address, install the libnss-mdns package and add mdns to your /etc/nsswitch.conf for hosts. It will look something like this.



Then SSH from the guest OS to the host OS by using the Bonjour address "host.local". Substitute your real Mac hostname for host, of course. I have "Loki.local". That should work for sshfs as well.

You can also install avahi-daemon and then your Linux guest OS will appear on the Bonjour lists under the Macintosh, so you can ssh to "guest.local" from Terminal. Very cool.


Ha! thanks. This is excellent and simple. With ubuntu nss is already setup, so name resolution on the "local" network already works.

sibs
 
In OS X you can use a terminal and run ipconfig -a. Or if you're a mouse kind of guy you can open the System Preferences object, open the network object, click on the tcp/ip button and read the results. If you are not using dhcp (and there are a stunning number of reasons why you would be better off doing this) you can create host table entries for both systems. You get a very stabile environment out of it that has a very low astonishment factor.

dp

Thanks for the reply, but the guest needs to find the host IP automagically at boot... and it's a laptop, so all the IPs are indeed dynamic.

It turns out that using NSS from the guest os makes this trivial because <host>.local resolves to the ip address of the host machine. sweet eh?
 
Is there a particular advantage to running sshfs here? It seems to me that the added security of sshfs comprises unnecessary overhead in this case, because it is possible to completely wall off the direct network connection between your host and guest OS.

For example, if you're running the guest OS on a host-only network, you can configure Mac OSX to serve NFS or SMB only over the host-only adapter. Even if you run Internet Connection Sharing to punch the guest OS out to the outside world, nobody can see how you're sharing files.

Or, if you want to use bridged networking, you can fix the firewall so that the the file service (NFS, SMB) goes only between the host and guest IP addresses.

So basically what I'm saying is that I'd probably be looking for the lightest-weight file sharing service I could find, and let the firewall offer the protection. Seems like it would be more efficient than encryption.

If there's a simple explanation as to why I'm wrong, I apologize in advance :)
 
gsibley said:
Thanks for the reply, but the guest needs to find the host IP automagically at boot... and it's a laptop, so all the IPs are indeed dynamic.

It turns out that using NSS from the guest os makes this trivial because <host>.local resolves to the ip address of the host machine. sweet eh?

Are you using DHCP then?
 
mcg said:
Is there a particular advantage to running sshfs here? It seems to me that the added security of sshfs comprises unnecessary overhead in this case, because it is possible to completely wall off the direct network connection between your host and guest OS.

For example, if you're running the guest OS on a host-only network, you can configure Mac OSX to serve NFS or SMB only over the host-only adapter. Even if you run Internet Connection Sharing to punch the guest OS out to the outside world, nobody can see how you're sharing files.

Or, if you want to use bridged networking, you can fix the firewall so that the the file service (NFS, SMB) goes only between the host and guest IP addresses.

So basically what I'm saying is that I'd probably be looking for the lightest-weight file sharing service I could find, and let the firewall offer the protection. Seems like it would be more efficient than encryption.

If there's a simple explanation as to why I'm wrong, I apologize in advance :)


Yeah, I thought about these too, and I agree with you. The only benefit really is that I don't have to run yet another server, since sshd is already running.

Ideally there would be some mechanism to allow the guest OS to mount the hardware directly. Maybe there is? dunno. does one of the drives in /dev map to the real HD? (I'd check, but I'm at work w/o my mac).

My bigger problem, and I know this is off topic, is getting middle click to work. It's pretty hard to code w/o middle click to paste in the shell.

G
 
Back
Top