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 know this subject has been discussed so many times that I'm almost ashamed I haven't found the solution to my issue yet. Clearly there is something I quite don't understand and would really appreciate any input or pointer.

Backgroud

  • Linux 3.2.0-4-amd64 #1 SMP Debian 3.2.51-1 x86_64 GNU/Linux
  • All cmds are run as root and ssh key has been copied to remote's .ssh/authorized_keys
  • use ssh-agent to unlock the key
  • Normal sshfs cmd works as expected - sshfs USER@REMOTE:/ /mnt/ssh/backup
  • Adding the entry to fstab and doing a "mount -a" works as expected - sshfs#USER@REMOTE:/ /mnt/ssh/backup/ fuse defaults 0 0


#:automount -V

Linux automount version 5.0.7

Directories:
    config dir:     /etc/default
    maps dir:       /etc
    modules dir:    /usr/lib/x86_64-linux-gnu/autofs

Compile options:
  ENABLE_FORCED_SHUTDOWN ENABLE_IGNORE_BUSY_MOUNTS WITH_HESIOD 
  WITH_LDAP WITH_SASL LIBXML2_WORKAROUND


#:automount -m

autofs dump map information
===========================

global options: none configured

Mount point: /mnt/ssh

source(s):

  instance type(s): file 
  map: /etc/auto.sshfs

  backup | -fstype=fuse,rw,nodev,noatime,allow_other,default_permissions,max_read=65536 :sshfs#USER@REMOTE:/


auto.master

/mnt/ssh        /etc/auto.sshfs         --timeout=30,--ghost,--debug


auto.sshfs

backup          -fstype=fuse,rw,nodev,noatime,allow_other,default_permissions,max_read=65536 :sshfs#USER@REMOTE:/


When I automount in foreground the auto.master as detailed below, the "backup" folder is created and the remote dir is mounted with no issue at all. I can ls -al the /mnt/ssh/backup folder and am indeed browsing the remote host

#:automount -f -v -d auto.master
#:ls -al /mnt/ssh/backup

attempting to mount entry /mnt/ssh/backup
lookup_mount: lookup(file): looking up backup
lookup_mount: lookup(file): backup -> -fstype=fuse,rw,nodev,noatime,allow_other,default_permissions,max_read=65536 :sshfs#USER@REMOTE:/
parse_mount: parse(sun): expanded entry: -fstype=fuse,rw,nodev,noatime,allow_other,default_permissions,max_read=65536 :sshfs#USER@REMOTE:/
parse_mount: parse(sun): gathered options: fstype=fuse,rw,nodev,noatime,allow_other,default_permissions,max_read=65536
parse_mount: parse(sun): dequote(":sshfs#USER@REMOTE:/") -> :sshfs#USER@REMOTE:/
parse_mount: parse(sun): core of entry: options=fstype=fuse,rw,nodev,noatime,allow_other,default_permissions,max_read=65536, loc=:sshfs#USER@REMOTE:/
sun_mount: parse(sun): mounting root /mnt/ssh, mountpoint backup, what sshfs#USER@REMOTE:/, fstype fuse, options rw,nodev,noatime,allow_other,default_permissions,max_read=65536
do_mount: sshfs#USER@REMOTE:/ /mnt/ssh/backup type fuse options rw,nodev,noatime,allow_other,default_permissions,max_read=65536 using module generic 
mount_mount: mount(generic): calling mkdir_path /mnt/ssh/backup
mount_mount: mount(generic): calling mount -t fuse -s -o rw,nodev,noatime,allow_other,default_permissions,max_read=65536 sshfs#USER@REMOTE:/ /mnt/ssh/backup
spawn_mount: mtab link detected, passing -n to mount
mount_mount: mount(generic): mounted sshfs#USER@REMOTE:/ type fuse on /mnt/ssh/backup


But when I start the autofs service as detailed below, the "backup" folder gets created but as soon as I try to ls the directory, it just refuses to mount.

#:service autofs start
#:ls -al /mnt/ssh/backup

attempting to mount entry /mnt/ssh/backup
lookup_mount: lookup(file): looking up backup
lookup_mount: lookup(file): backup -> -fstype=fuse,rw,nodev,noatime,allow_other,default_permissions,max_read=65536 :sshfs#USER@REMOTE:/
parse_mount: parse(sun): expanded entry: -fstype=fuse,rw,nodev,noatime,allow_other,default_permissions,max_read=65536 :sshfs#USER@REMOTE:/
parse_mount: parse(sun): gathered options: fstype=fuse,rw,nodev,noatime,allow_other,default_permissions,max_read=65536
parse_mount: parse(sun): dequote(":sshfs#USER@REMOTE:/") -> :sshfs#USER@REMOTE:/
parse_mount: parse(sun): core of entry: options=fstype=fuse,rw,nodev,noatime,allow_other,default_permissions,max_read=65536, loc=:sshfs#USER@REMOTE:/
sun_mount: parse(sun): mounting root /mnt/ssh, mountpoint backup, what sshfs#USER@REMOTE:/, fstype fuse, options rw,nodev,noatime,allow_other,default_permissions,max_read=65536
do_mount: sshfs#USER@REMOTE:/ /mnt/ssh/backup type fuse options rw,nodev,noatime,allow_other,default_permissions,max_read=65536 using module generic
mount_mount: mount(generic): calling mkdir_path /mnt/ssh/backup
mount_mount: mount(generic): calling mount -t fuse -s -o rw,nodev,noatime,allow_other,default_permissions,max_read=65536 sshfs#USER@REMOTE:/ /mnt/ssh/backup
spawn_mount: mtab link detected, passing -n to mount
>> read: Connection reset by peer
mount(generic): failed to mount sshfs#USER@REMOTE:/ (type fuse) on /mnt/ssh/backup
dev_ioctl_send_fail: token = 22
failed to mount /mnt/ssh/backup


I've tested numerous workarounds, including but not limited to

  • escaping the :sshfs#USER@REMOTE:/ - :sshfs\#USER@REMOTE\:/
  • removing the / - :sshfs#USER@REMOTE:
  • providing a path for my identity file in auto.sshfs - IdentityFile=/root/.ssh/id_rsa
  • specifying uid/gid in auto.master - /mnt/ssh /etc/auto.sshfs uid=0,gid=0,--timeout=30,--ghost


I'm now out of ideas and stuck.

Thanks in advance, JS


UPDATE

@KaszpiR - Thanks for the effort but the proper key has already been uploaded to the remote's authorized_keys file and standard sftp or sshfs works flawlessly.

It seems that the autofs initscript (or one of the options used to launch automount in the script) is creating the issue but haven't had the time to debug it properly.

As a workaround you can remove the /etc/init.d/autofs script completely (update-rc.d autofs remove and move it to a backup location for safekeeping) and launch automount manually or via a script.

share|improve this question

1 Answer 1

I had the same issue, had to add ssh key from the root user when connecting to the remote machine, to allow passwordless ssh logins:


sudo su -

ssh-keygen -t rsa

ssh-copy-id -i ~/.ssh/id_rsa.pub remote_user@remote_server

try to ssh to the remote machine, you should not be asked for password.

restart autofs

share|improve this answer

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.