sshfs:无法设置文件时间戳

miv*_*ivk 9 networking linux unix sshfs fuse

在 Ubuntu 上使用 sshfs 和 autofs,我无法在远程文件上设置时间戳:

$ touch /sshfs/server/some/file
touch: setting times of `/sshfs/sshfs/server/some/file': Permission denied
Run Code Online (Sandbox Code Playgroud)

我确实对文件有写访问权限。问题浮出水面是因为复制到远程的文件没有获得原始的时间戳,而是复制完成的时间。

如果我通过 ssh 连接到服务器,我也可以毫无困难地更改时间戳。它只能通过 sshfs 失败。

$ cat /etc/auto.sshfs 

afserver -fstype=fuse,sshfs_debug,rw,nodev,nonempty,noatime,allow_other,max_read=65536   :sshfs\#my_username@server.domain.lan:/

$ stat  /sshfs/server/some/file
...
Access: (0664/-rw-rw-r--)  Uid: ( 1003/ UNKNOWN)   Gid: (  100/   users)
Run Code Online (Sandbox Code Playgroud)

Ern*_*tas 0

http://sourceforge.net/mailarchive/message.php?msg_id=26780130(FUSE 邮件列表 - 基本上,SSHFS 实现的内容)来看,您遇到了这个问题,因为 /sshfs/server/some/ 中使用的文件系统没有处理所使用的属性处理程序。对于您正在使用的 SSHFS 实施,没有任何解决方案。

编辑
抱歉,我没有看到您设置了“noatime”选项。为什么?去掉它。这应该可以解决这里的问题。