我的大学提供了对学生大学帐户的 ssh 访问,我只是设置了一个 sshfs 来访问我远程帐户上的一些文件夹。
我在本地机器上运行 pop_os 并使用 systemd automount 和以下选项: noauto,x-systemd.automount,_netdev,user,idmap=user,follow_symlinks,workaround=rename,IdentityFile=/home/me/.ssh/identityfile,allow_other,default_permissions,uid=1000,gid=1000,ServerAliveInterval=15
Automount 工作正常,我可以浏览我的远程文件夹,但是我在替换文件和递归复制文件夹到远程文件夹时遇到了一些麻烦。
但是每次我尝试使用 vim 在远程 fs 上编辑文件时,编辑器都会在打开文件之前挂起 60 秒(非常准确,我猜这与连接超时参数有关)。当文件最终打开时,我收到错误说明E297: Write error in swap file并E72: Close error on swap file从 vim关闭。
但有时(特别是在我重新加载 dameon 并在更新 /etc/fstab 中的选项后重新启动自动挂载服务之后,文件会立即打开,没有错误。
我在 sshfs 上打开文件时运行了 strace,这里是问题似乎发生的日志示例:
0.000032 openat(AT_FDCWD, ".../myremotefile.c", O_RDONLY) = 3
0.041890 readlink(".../myremotefile.c", 0x7ffd99b19540, 4095) = -1 EINVAL (Invalid argument)
0.000302 openat(AT_FDCWD, ".../.myremotefile.c.swp", O_RDONLY) = -1 ENOENT (No such file or directory)
0.029883 openat(AT_FDCWD, ".../.myremotefile.c.swp", O_RDWR|O_CREAT|O_EXCL, 0600) = …Run Code Online (Sandbox Code Playgroud)