我知道这个问题已经讨论过很多次了,我几乎觉得惭愧,我还没有find解决scheme。 显然有一些我不明白,真的很感激任何input或指针。
sshfs USER@REMOTE:/ /mnt/ssh/backup 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:/
当我在前台自动挂载auto.master(详情如下)时,将创build“backup”文件夹,并且远程目录根本不会被挂载。 我可以ls -al / mnt / ssh / backup文件夹,确实正在浏览远程主机
#: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
但是,当我启动autofs服务如下所述,“备份”文件夹被创build,但只要我试图ls目录,它只是拒绝安装。
#: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
我已经testing了许多解决方法,包括但不限于
:sshfs\#USER@REMOTE\:/ :sshfs#USER@REMOTE: IdentityFile=/root/.ssh/id_rsa /mnt/ssh /etc/auto.sshfs uid=0,gid=0,--timeout=30,--ghost 我现在没有想法,卡住了。
在此先感谢,JS
@KaszpiR – 感谢您的努力,但正确的密钥已经上传到远程的authorized_keys文件和标准的sftp或sshfs完美地工作。
看来,autofs initscript(或用于在脚本中启动automount的选项之一)正在创build问题,但没有足够的时间来正确debugging它。
作为解决方法,您可以完全删除/etc/init.d/autofs脚本(update-rc.d autofs删除并将其移至备份位置以便妥善保pipe),然后手动或通过脚本启动automount。
我有同样的问题,连接到远程机器时,必须从根用户添加SSH密钥,以允许无密码的SSHlogin名:
sudo su - ssh-keygen -t rsa ssh-copy-id -i ~/.ssh/id_rsa.pub remote_user@remote_server
尝试SSH到远程机器,你不应该被要求input密码。
重新启动autofs