sshfs is not mounting automatically at boot, despite /etc/fstab configuration

52

Solution 1

I experienced the exact same problem after upgrading from Oneiric (where the automount worked fine) to Precise.

What solved the problem for me was adding the delay_connect option. In addition, I've been using the option "workaround=rename" already before, since Oneiric times. Not sure whether it is still needed today, but at least it doesn't seem to hurt.

My full /etc/fstab line is:

sshfs#user@host:/remote/dir /local/dir fuse delay_connect,idmap=user,uid=1000,gid=1000,umask=0,allow_other,_netdev,workaround=rename 0 0

You obviously would need to adapt user/group IDs to your own environment.

Solution 2

Also to complement all previous comments,

  1. Make sure you allow non-root users to specify the allow_other mount option in /etc/fuse.conf

  2. Make sure you use each sshfs mount at least once manually while root so the host's signature is added to the ~/.ssh/known_hosts file.

    sshfs [user]@[host]:[remote_path] [local_path] -o allow_other,IdentityFile=[path_to_id_rsa]
    
Share:
52

Related videos on Youtube

Adeel Ahmad
Author by

Adeel Ahmad

Updated on September 18, 2022

Comments

  • Adeel Ahmad
    Adeel Ahmad almost 2 years

    android Asynctask has been modified quite frequently between different API-levels. I'm developing an Application in which i've to upload images to FTP server. i want to do that in serialized order (images upload after one-another by one image upload per asyntask). I understand the SERIAL_EXECUTOR and THREAD_POOL_EXECUTOR stuff, but i just want some clarity about what is the default behavior of asynctask ( my min. target API is ICS 4.0 ). if i simply execute say 10 asyncs' in a loop, will they go to thread queue and execute one by one or they'll just go parallel ?

    • glibdud
      glibdud about 10 years
      Ever get this figured out? I'm running into the same issue on an Ubuntu 14.04 64-bit machine.
    • Ad N
      Ad N about 10 years
      Seeing the popularity of this question, compared to the number of answers, I gave up the fstab approach. I decided to bite the bullet and learn how to use Automount, addressing the big picture problem. From my experience it was "the right choice". A good introduction to Automount can be found on the Ubuntu wiki.
    • hata
      hata almost 9 years
      If you control threads by yourself, I think, directly using Thread class and Handler class may be short cut. It will be all under your control!
  • Ad N
    Ad N over 10 years
    I think the "mount only when network ready" is already asked using _netdev, and changing with noautowould make it unable to mount at boot (only explicitly when using the mount command)
  • Nicolas
    Nicolas almost 10 years
    Worked for me without workaround=rename where it didn't worked before. So my only change was adding the delay_connect option, that definitely helped here! Thank you for this. Just wondering why _netdev is not enough here...
  • Adeel Ahmad
    Adeel Ahmad almost 9 years
    that was : async task Inside loop.
  • AJefferiss
    AJefferiss over 8 years
    Can you expand on the delay_connect option? Where's it added to? Edit your question to include some more information about it.
  • Tony
    Tony over 8 years
    You add it in the fstab option list: sshfs#user@host:/remote /mnt/local fuse delay_connect,uid=1000,gid=100,umask=0,allow_other 0 0
  • Auspex
    Auspex almost 8 years
    That works perfectly for me, too. @Nicolas, I believe the _netdev issue is explained in Tony's answer. The network may be up, but it still can't resolve the host. Obviously, using an IP address would solve that, but who wants IP addresses in their fstab?
  • Jonathan
    Jonathan almost 8 years
    For what it's worth, somehow when I copy pasted this into atom, it picked up invisible characters that broke it. I had to remove those
  • Jonathan
    Jonathan almost 8 years
    It mounts okay but then I get: ls /backup: Input/output error
  • MountainX
    MountainX over 6 years
    The allow_other mount option exposes an unresolved security bug in the Linux kernel: if the default_permissions mount option is NOT used along with allow_other, the results of the first permission check performed by the file system for a directory entry will be re-used for subsequent accesses as long as the inode of the accessed entry is present in the kernel cache - even if the permissions have since changed, and even if the subsequent access is made by a different user.
  • aSystemOverload
    aSystemOverload about 6 years
    Adding 'delay_connect, workaround=rename' worked for me on Arch Linux. Thanks!
  • opinion_no9
    opinion_no9 almost 3 years
    delay_connect option made the difference in Ubuntu 20.04.3 - Thanks a lot!! ("workaround=rename" was NOT necessary)