问题原文
原帖链接 · Slizzered · CC BY-SA 3.0
Assuming I have a folder /mnt/mountpoint that I use as a mountpoint for some sshfs-mounted directory:
sshfs user@host /mnt/mountpoint
Now, I want to prevent applications to write to /mnt/mountpoint while it is unmounted. Questions I found here and here have answers that imply using
sudo chattr +i /mnt/mountpoint
which works fine to prevent any write-access. Unfortunately, it also prevents me from mounting with sshfs as a normal user.
What would be the best solution for this? I would prefer a single sshfs-command or something that at least doesn't require root privileges. Should I forego the chattr approach and try something entirely different?
已采纳解答
原帖链接 · Aaron · CC BY-SA 3.0
Mount point default permissions
Create the mountpoint with
mkdir --mode=0500 -p /mnt/mountpoint
Only the creating user will be able to write to it. You could pre-populate this from rc.local. When you mount whatever filesystem lives on top of that mount point, it will pick up the permissions of that overlay that you had set when it was mounted.
On a side note, I would avoid chattr +i as that will confuse folks and cause troubleshooting fun down the road if not everyone is aware you did that.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
