You are not logged in.
Hi,
I would like to mount filesystems over ssh using sshfs and autofs. I have two ssh filesystems, one on host 'bob' and one on host 'bender'. I have a dns system and static ips set up so I can access hosts by their names. On my user's desktop folder (called 'bureaublad') I have two empty folders named 'bob' and 'bender' which I use as mount points, like so:
sshfs diederick@bender:~/ /home/diederick/bureaublad/bender
sshfs diederick@bob:~/ /home/diederick/bureaublad/bobThis works nicely. Now I don't want to open a terminal window and enter this line every time I have to access these hosts, so I'd like to use autofs to mount them whenever I access the mount points. Following the steps at http://wiki.archlinux.org/index.php/Autofs#Remote_SSH I have created an auto.ssh file with these contents:
bender -fstype=fuse,rw,allow_other,IdentityFile=/home/diederick/.ssh/id_rsa :sshfs #diederick@bender\:~/
bob -fstype=fuse,rw,allow_other,IdentityFile=/home/diederick/.ssh/id_rsa :sshfs\#diederick@bob\:~/The contents of my auto.master file are:
# Sample auto.master file
# Format of this file:
# mountpoint map options
# For details of the format look at autofs(5).
#/media /etc/autofs/auto.media
/home/diederick/bureaublad/bender /etc/autofs/auto.ssh --timeout=60
/home/diederick/bureaublad/bob /etc/autofs/auto.ssh --timeout=60Now when I start the aufofs daemon and cd into ~/bureaublad/bender/ or ~/bureaublad/bob/, instead of the contents of the remote file system, I see two folders, one named 'bender' and one named 'bob':
diederick@zaphod:~$ ls -la bureaublad/bender/
total 4
drwxr-xr-x 4 root root 0 Oct 9 15:01 .
drwxr-xr-x 6 diederick diederick 4096 Oct 9 14:52 ..
dr-xr-xr-x 2 root root 0 Oct 9 15:01 bender
dr-xr-xr-x 2 root root 0 Oct 9 15:01 bobWhen I try to cd into 'bender' or 'bob' this happens:
diederick@zaphod:bender$ cd bender/
bash: cd: bender/: No such file or directoryCan somebody tell me what I'm missing?
Thanks for any help!
Last edited by diederick76 (2010-10-10 21:25:11)
Offline
A few problems i see:
- your first ssh line for bender has a space instead of a backward flash before the #
- you're including auto.ssh twice in auto.master, while you're supposed to enter a single parent directory. e.g.:
/media/ssh /etc/autofs/auto.ssh --timeout=60In this case, any targets in auto.ssh will be automatically created as directories like /media/ssh/bender/ when you start autofs.
- i'm not sure if a tilde ~ works when you mount through autofs, you might want to try using a full path just in case or place a backward slash before it.
ᶘ ᵒᴥᵒᶅ
Offline
The space instead of the slash was a typo in my post. Your other suggestion did the trick. Thanks! ![]()
Offline
The space instead of the slash was a typo in my post. Your other suggestion did the trick. Thanks!
Great, please mark your topic solved. ![]()
ᶘ ᵒᴥᵒᶅ
Offline
Actually, I was to early with my last remark. ![]()
One of the machines, bender, mounts as expected and without problem, the other, bob, does not.
My auto.ssh is now:
bob -fstype=fuse,rw,allow_other,IdentityFile=/home/diederick/.ssh/id_rsa :sshfs\#diederick@bob\:/home/diederick/
bender -fstype=fuse,rw,allow_other,IdentityFile=/home/diederick/.ssh/id_rsa :sshfs\#diederick@bender\:/home/diederick/And my auto.master:
# Sample auto.master file
# Format of this file:
# mountpoint map options
# For details of the format look at autofs(5).
#/media /etc/autofs/auto.media
/home/diederick/bureaublad /etc/autofs/auto.ssh --timeout=60When I cd into bureaublad/bender/, I see the remote filesystem. But when I cd into bureaublad/bob, I get:
diederick@zaphod:~$ cd bureaublad/bob/
bash: cd: bureaublad/bob/: No such file or directorydaemons.log shows these lines when I do that:
Oct 9 19:03:46 localhost automount[3973]: attempting to mount entry /home/diederick/bureaublad/bob
Oct 9 19:03:46 localhost automount[3973]: >> read: Connection reset by peer
Oct 9 19:03:46 localhost automount[3973]: mount(generic): failed to mount sshfs#diederick@bob:/home/diederick/ (type fuse) on /home/diederick/bureaublad/bob
Oct 9 19:03:46 localhost automount[3973]: failed to mount /home/diederick/bureaublad/bob
Oct 9 19:03:46 localhost automount[3973]: attempting to mount entry /home/diederick/bureaublad/bob
Oct 9 19:03:46 localhost automount[3973]: failed to mount /home/diederick/bureaublad/bobIs there any way to find out what's going on here? ssh'ing directly into bob works fine, the keys are okay and mounting manually using sshfs works without issue as well. The only difference between the machines is that bob has a wireless connection.
Last edited by diederick76 (2010-10-09 17:10:32)
Offline
You can add the debug flag to auto.master for verbose log-output:
/home/diederick/bureaublad /etc/autofs/auto.ssh --timeout=60 --debugDon't forget to remove it again after testing or it will clog your logs. ![]()
ᶘ ᵒᴥᵒᶅ
Offline
You can add the debug flag to auto.master for verbose log-output:
/home/diederick/bureaublad /etc/autofs/auto.ssh --timeout=60 --debugDon't forget to remove it again after testing or it will clog your logs.
That seemed to work, thanks
. The --debug told me what command was used to mount bob's filesystem, and on executing that line manually I found that host bob was apparently unknown. After confirming the key fingerprint, autofs mounting works. Still, I wonder how that can be, since ssh'ing into bob already worked fine. Does autofs store its keys separately?
Offline
That seemed to work, thanks
. The --debug told me what command was used to mount bob's filesystem, and on executing that line manually I found that host bob was apparently unknown. After confirming the key fingerprint, autofs mounting works. Still, I wonder how that can be, since ssh'ing into bob already worked fine. Does autofs store its keys separately?
Autofs mounts as root, while you probably tested as a regular user before. That's why the wiki mentions to test the connection with sudo. ![]()
ᶘ ᵒᴥᵒᶅ
Offline
diederick76 wrote:That seemed to work, thanks
. The --debug told me what command was used to mount bob's filesystem, and on executing that line manually I found that host bob was apparently unknown. After confirming the key fingerprint, autofs mounting works. Still, I wonder how that can be, since ssh'ing into bob already worked fine. Does autofs store its keys separately?
Autofs mounts as root, while you probably tested as a regular user before. That's why the wiki mentions to test the connection with sudo.
Right. Thanks!
BTW I can't find a 'resolved' button/link.
Last edited by diederick76 (2010-10-10 19:52:23)
Offline
BTW I can't find a 'resolved' button/link.
Just edit the opening post and prepend [solved] to the title
Offline