The standard way to setup a central "/home" directory on a Linux workstation is using NFS. The problem is that I don't like the lack of real security in NFS. So instead I want to try to use SSHFS. SSHFS in-and-of itself works fine, the problem is with mounting it at boot. If I add a line to "/etc/fstab" for the SSHFS share, the workstation complains that it can't contact the SSH server. This is true because the "/etc/fstab" lines are executed before networking is actually up!

Right now I am using the following init script to mount "/home":


# Mounts "/home"  over SSHFS at boot

start () {
    while true; do
        ping -c 1 "" 1> /dev/null

        if [ "$?" = 0 ]; then

        sleep 1

    sshfs root@ /home/ -o transform_symlinks,allow_other,nonempty,hard_remove

case "$1" in

        echo "Usage: $0 {start}"
        exit 1


Basically it pings the SSH server once per second until it can connect, then it mounts the SSHFS share.

My question is: Is there a more direct and less "hack-ish" way to make "/etc/fstab" wait until there is an active network connection before attempting to mount "/home"?

An alternative idea I had, was adding the "sshfs root@ /home/ -o transform_symlinks,allow_other,nonempty,hard_remove" line as an "post-up" script in "/etc/network/interfaces", but that still feels wrong.


Server OS: Ubuntu Server Edition 10.04

Client OS: Ubuntu Desktop 10.04

1 Answer 1


You probably want to add the _netdev option to delay mounting until the network has been enabled:

sshfs#root@ /home/ fuse transform_symlinks,allow_other,_netdev,nonempty,hard_remove 0 0

You can also put your script in /etc/network/if-up.d/ or the mount command in /etc/rc.local.

  • Adding "_netdev" absolutely fixed it! Thank you for both the answer and the quick response time.
    – Soviero
    Nov 2, 2011 at 4:31

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.