Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 05-15-2015, 03:07 PM   #1
Registered: May 2004
Distribution: Debian
Posts: 39

Rep: Reputation: 1
automounting sshfs at boot using fstab

sshfs will work if I call sshfs directly, but if I use fstab and `mount -a`... it doesn't work.
I've added myself and root to the 'fuse' group.

in /etc/fstab
sshfs#root@ /media/MountedDir fuse.sshfs defaults,transform_symlinks,users,exec,auto,allow_other,_netdev,delay_connect,default_permissions 0 0

from /media directory
ls -l | grep MountedDir
ls: cannot access MountedDir: Input/output error
d?????????? ? ? ? ? ? MountedDir

mount | grep /media/MountedDir
sshfs#root@ on /media/MountedDir type fuse.sshfs (rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,_netdev)

df -h | grep /media/MountedDir
sshfs#root@ 1000G 0 1000G 0% /media/MountedDir

If I call `sudo mount -a` with this in /etc/fstab, using a GUI [non Ctrl+Alt+F1..F6] I get a popup asking me to input my password (has bars on the bottom that change color when I type a character) that doesn't even work if I put in the right password. It'll just popup again. Have to reboot or killall ssh sshfs [from a tty] or something like that to get rid of it.

Debian Linux 8/Jessie/Stable
Old 05-15-2015, 06:14 PM   #2
Keith Hedger
Senior Member
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,170

Rep: Reputation: 861Reputation: 861Reputation: 861Reputation: 861Reputation: 861Reputation: 861Reputation: 861
to start you need too set up public/privare keys so you dont use a passowrd , more importantly i dont think this is going to work as disks are mounted from the fstab at boot time before the network is up.

maybe add the commands to /etc/rc.local or whatever your system uses as a user defined start up script.
Old 05-15-2015, 07:04 PM   #3
Registered: May 2004
Distribution: Debian
Posts: 39

Original Poster
Rep: Reputation: 1
I've done the
ssh-copy-id root@
so I can use sshfs command without using password.

Some fstab options I've used:

The filesystem resides on a device that requires network access (used to prevent the system from attempting to mount these filesystems until the network has been enabled on the system).

delay connection to server

Just tried removing the 'delay_connect' option and it looks like that may have worked for getting things to work with `sudo mount -a`, but it didn't help with it mounting on reboot. Looks like I have to enter my password to get it to mount through fstab, eventhough I can mount it without password using the 'sshfs' command.

Last edited by BryanFRitt; 05-15-2015 at 07:24 PM. Reason: added the works but...
Old 05-15-2015, 09:22 PM   #4
Registered: May 2004
Distribution: Debian
Posts: 39

Original Poster
Rep: Reputation: 1
I found some scripts that help mount/unmount when the network goes up/down.
These scripts requires the line requires the additon of comment=sshfs to the option section of the fstab line, and in some cases maybe the GID=, and UID= options too.
(and maybe instead of sshfs# style use fuse.sshfs didn't look to into, but that seamed to have maybe helped)

root@ /media/MountedDir fuse.sshfs comment=sshfs,defaults,transform_symlinks,users,exec,auto,allow_other,_netdev,uid=1000,gid=1000 0 0
Tried and it works even after reboot.

Last edited by BryanFRitt; 05-15-2015 at 10:18 PM. Reason: added update: "Tried and it works even after reboot.", formatting
1 members found this post helpful.


fstab, mount, ssh, sshfs

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] sshfs mount issues with fstab lleb Linux - Newbie 5 04-25-2012 09:00 AM
SSHFS fstab entries DeadlyMuffin Linux - Software 3 01-07-2010 09:30 AM
ntfs partition not automounting with fstab cylux Linux - General 10 05-10-2009 06:02 PM
fstab and automounting permanent symlinks vertigo12369 Linux - Newbie 2 04-23-2009 12:00 PM
Automounting directory in fstab troubles cjtemple Linux - Newbie 9 01-07-2007 03:21 AM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 11:34 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration