Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

2 Answers 2

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. –  salamis Oct 3 '12 at 15:56
1  
Oh, righ. How about adding mount -a in rc.local? –  radoslawc Oct 5 '12 at 13:01
    
hm.. I will try that. –  salamis 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. –  salamis Oct 3 '12 at 15:57

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.