我遵循了sshfs“按需”安装的说明,但它不起作用。
我在/etc/fstab中添加了以下内容:
username@hostname:/ /mnt/remotes/hostname fuse.sshfs noauto,x-systemd.automount,_netdev,users,idmap=user,IdentityFile=/home/stanley/.ssh/my_rsa_key,allow_other,reconnect 0 0然后我运行了sudo mount -a,它什么也不做。我还试过systemctl daemon-reload && systemctl restart proc-sys-fs-binfmt_misc.automount。
因此,我跟踪了故障排除提示,并使用了以下方法:
username@hostname:/ /mnt/remotes/hostname fuse.sshfs ssh_command=ssh\040-vv,sshfs_debug,debug,_netdev,users,idmap=user,IdentityFile=/home/stanley/.ssh/my_rsa_key,allow_other,reconnect 0 0然后运行sudo mount -av。在一个独立的终端中,我可以访问那个挂载点。
因此,ssh和sftp是工作的,2) sshfs是工作的,3)权限很好。
所以只有按需部分不起作用-我做错什么了?
发布于 2018-09-05 19:25:36
这些说明令人困惑,特别是对于不懂系统的人。
正确的程序:
/etc/fstab:username@hostname:/ /mnt/remotes/hostname fuse.sshfs noauto,x-systemd.automount,_netdev,users,idmap=user,IdentityFile=/home/stanley/.ssh/my_rsa_key,allow_other,reconnect 0 0sudo systemctl daemon-reload。这将创建一个systemd“单元文件”。systemctl list-unit-files --type automount找出哪个单元文件。对我来说是mnt-remotes-hostname.automount。sudo systemctl restart mnt-remotes-hostname.automount。cd /mnt/remotes/hostname或ls /mnt/remotes/hostname,它将自动创建sftp连接!这很管用,但我还不确定
allow_other是一种安全风险,我需要研究一下如果有人能弄清楚这点,请说。
按照@sourcejedis的回答进行更新,停止挂载必须按照以下顺序进行:systemctl stop whatever.mount && systemctl stop whatever.automount,不应该使用umount mounpoint!
发布于 2019-10-10 09:34:24
我知道这是一个很老的帖子,但我只是设置了一个sshfs,并遇到了一个类似的问题。对我来说,解决方案是生成一个没有密码的rsa密钥,因为当使用systemd automount自动生成时,无法提示您输入身份文件密码。
https://unix.stackexchange.com/questions/467081
复制相似问题