Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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

share|improve this answer
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 '12 at 15:56
Oh, righ. How about adding mount -a in rc.local? – radoslawc Oct 5 '12 at 13:01
hm.. I will try that. – glarkou Oct 6 '12 at 16:53

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.

share|improve this answer
Hm... I think you are right. I will try this. – glarkou Oct 3 '12 at 15:57

Your Answer


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.