I'm desperetely trying to auto mount my distant folder using autofs & sshfs, but I can't make it work. (I'm under Fedora 16)
This works :
sshfs cx42net@xxx.xxx.xxx.xxx:/my/data /home/cx42net/data-distant -o uid=1000 -o gid=1000
So I defined a RSA key to use with ssh, tried a ssh
connect, it worked without asking my password. Then I tried again the previous sshfs
command, and it worked well (yay!)
So now, I want to use autofs
, and that's where the problem starts :
Content of my /etc/auto.master file :
#
# Sample auto.master file
# This is an automounter map and it has the following format
# key [ -mount-options-separated-by-comma ] location
# For details of the format look at autofs(5).
#
/misc /etc/auto.misc
#
# NOTE: mounts done from a hosts map will be mounted with the
# "nosuid" and "nodev" options unless the "suid" and "dev"
# options are explicitly given.
#
/net -hosts
#
# Include /etc/auto.master.d/*.autofs
#
+dir:/etc/auto.master.d
#
# Include central master map if it can be found using
# nsswitch sources.
#
# Note that if there are entries for /net or /misc (as
# above) in the included master map any keys that are the
# same will not be seen as the first read key seen takes
# precedence.
#
+auto.master
/net /etc/auto.sshfs uid=1000,gid=1000,--timeout=30,--ghost
(1000:1000) is my local user uid/gid, not the distant (the SSH folder I'm trying to get)
My /etc/auto.sshfs :
data-distant -fstype=fuse,port=22,rw,allow_other :sshfs\#cx42net@xxx.xxx.xxx.xxx\:/mnt/data/dev
When I start autofs, here's what I've got in the /var/log/messages
:
Oct 28 23:59:30 pc-maison autofs[3318]: Starting automount: [ OK ]
So everything seems fine.
But I sometimes got this kind of messages:
Oct 28 23:41:01 pc-maison automount[2453]: create_udp_client: hostname lookup failed: Name or service not known
Oct 28 23:41:01 pc-maison automount[2453]: create_tcp_client: hostname lookup failed: Name or service not known
Oct 28 23:41:01 pc-maison automount[2453]: lookup_mount: exports lookup failed for data-distant
The folder /net/data-distant
have rights of my user "cx42net" (1000:1000)
What am I missing to make this works ?
Best Answer
Short:
Check that your sshfs command works with root user.
Longer:
Check that root user has ssh identity keys setup. Mounting of sshfs through autofs uses root user for the actual mount.
This is still meant only for desktop or laptop users with a single user using these mounts!
auto.master line
note! use your own uid and gid and specify your prefered mount point I use /auto/mehtod/address
auto.sshfs this is a bit more generic than just one mount
then link to folder you want to access ln -s /auto/sshfs/userid@my.remote.example.com/uhome/ remote-home