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

Notices


Reply
  Search this Thread
Old 05-15-2015, 03:07 PM   #1
BryanFRitt
Member
 
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@192.168.2.4:/ /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@192.168.2.4:/ 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@192.168.2.4:/ 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,150

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
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
BryanFRitt
Member
 
Registered: May 2004
Distribution: Debian
Posts: 39

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

Some fstab options I've used:

_netdev
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_connect
delay connection to server

http://unix.stackexchange.com/questi...etc-fstab-work

--
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
BryanFRitt
Member
 
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.
http://ubuntuforums.org/showthread.php?t=430312
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)

Code:
root@192.168.2.4:/ /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.
  


Reply

Tags
fstab, mount, ssh, sshfs



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:25 AM.

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