我有一个 ubuntu 服务器“远程”,用户为 srichter。在服务器上的我的主目录中,我有一些具有不同权限的文件,如下所示:
srichter@remote:~> ls -l
drwx------ 13 srichter srichter 4096 Jun 16 22:48 secret
drwxr-xr-x 13 srichter users 4096 Feb 24 14:51 public
在我的本地计算机上,我安装了 sshfs 和 fusion 以及使 autofs 正常工作的所有内容。我本地的 auto.master 看起来像这样:
+auto.master # what's that line for?
/autofs/remote /etc/auto.remote.conf uid=srichter gid=srichter -v --ghost --timeout=30
相应的auto.remote.conf具有以下内容:
mnt -fstype=fuse,rw,nodev,noempty,noatime,allow_other,max_read=65536 :sshfs\#srichter@remote\:
这就像一个魅力:我可以 cd 到/autofs/remote/mnt 和 ls -l 给我
drwx------ 13 srichter srichter 4096 Jun 16 22:48 secret
drwxr-xr-x 13 srichter srichter 4096 Feb 24 14:51 public
请注意,只有 srichter 才能访问 secret 目录。那就是问题所在。 如果我在本地计算机上以访客身份登录,我可以 cd 到 secret 目录并查看(并编辑)其内容:
srichter@local:~> su guest
guest@local:~> groups
users
guest@local:~> cd /autofs/remote/mnt
guest@local:/autofs/remote/mnt> ls -l
drwx------ 13 srichter srichter 4096 Jun 16 22:48 secret
drwxr-xr-x 13 srichter srichter 4096 Feb 24 14:51 public
guest@local:/autofs/remote/mnt> cd secret
guest@local:/autofs/remote/mnt/secret> ls -l
-rw------- 1 srichter srichter 470340 Jul 2 2012 secret.file1
-rw------- 1 srichter srichter 9547092 Jun 7 02:06 secret.file2
guest@local:/autofs/remote/mnt/secret> cat secret.file1
This is the content for secret.file1, which should not be visible to anyone but srichter.
那么,为什么访客可以访问我的文件以及我做错了什么?
提前谢谢您!
最佳答案
sshfs默认不允许内核检查权限
你需要使用
sshfs -o allow_other,default_permissions
我不确定如何将其与 autofs 一起使用,因为我只直接使用 sshfs,但它应该能够插入某个地方
关于linux - autofs/sshfs 不遵守远程权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17308272/