0

I edited the file /etc/rc.d/rc.local and added the following lines in order to mount a remote directory through sshfs at boot time:

su user -c "/usr/bin/sshfs -o idmap=user -o reconnect -o allow_other -o uid=500 -o gid=500  user@remote:/home/shares/allusers /home/user/mnt"

The problem is that is not mounting the directory on startup but when I execute this command manually after logging in everything works as expected an the directory is mounted.

Any suggestions?

3 Answers 3

1

Try adding

sshfs#user@remote:/home/shares/allusers /home/user/mnt" fuse defaults,idmap=user

to /etc/fstab

test it with mount -a if ok, reboot

3
  • I tried this but it is not working while rebooting because during that time I suppose the machine is not connected to the Internet.
    – glarkou
    Oct 3, 2012 at 15:56
  • 1
    Oh, righ. How about adding mount -a in rc.local?
    – radoslawc
    Oct 5, 2012 at 13:01
  • hm.. I will try that.
    – glarkou
    Oct 6, 2012 at 16:53
0

rc.local will be executing as root so you'll need to make sure root has an SSH key that will work with the specified user at the remote host, or specify the key to use with -o IdentityFile=/home/user/.ssh/my_key*.

*Couldn't test this as it looks like my version of sshfs is too old to have the option.

1
  • Hm... I think you are right. I will try this.
    – glarkou
    Oct 3, 2012 at 15:57
0

Instead of adding mount -a to rc.local as suggested by previous answers one can simply add delay_connect as a fstab option.

(This could have been a comment, but my rep count is too low)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .