Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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,

Regards,

David

share|improve this question

1 Answer 1

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
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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