假设我有一个文件夹/mnt/mountpoint用作某些sshfs-mounted 目录的挂载点:
sshfs user@host /mnt/mountpoint
Run Code Online (Sandbox Code Playgroud)
现在,我想阻止应用程序在/mnt/mountpoint卸载时写入。我在这里和这里找到的问题的答案暗示使用
sudo chattr +i /mnt/mountpoint
Run Code Online (Sandbox Code Playgroud)
这可以很好地防止任何写访问。不幸的是,它也阻止了我sshfs作为普通用户安装。
什么是最好的解决方案?我更喜欢单个 sshfs-command 或至少不需要 root 权限的东西。我应该放弃这种chattr方法并尝试完全不同的方法吗?