I have a ubuntu home server 12.10 that is available over the internet for SSH connections. I also have my ubuntu laptop that I use at home and when on the road. What I would like is that during the boot, depending on the available WiFi connection, it either chooses cifs when on my home network, or SSHFS otherwise.

I don't want to use SSHFS by default on my home network as by going via dyndns and my limited home internet connection upload speed, I think it will be significantly slower for day to day tasks at home.

I don't think fstab has some sort of heirarchical mount tree that would allow me to do this (from what I have read in the man pages anyway).

Does this seem logical/reasonable, or am I going about it the wrong way? And if it is valid, how would I go about doing it?

Thanks in advance,




Why not create a user-land script that runs when you log in? Try to do the cifs mount in /etc/fstab, if it fails do the sshfs when you log in.

Just add this to your login scripts:

mount | grep -q 'myhomeserver' || sshfs mydyndns /mountpoint
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.