2

我有一个带有用户 srichter 的 ubuntu 服务器“远程”。在服务器上的主目录中,我有一些具有不同权限的文件,如下所示:

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 和 fuse 以及一切让 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 才能访问秘密目录。那就是问题所在。如果我在本地计算机上以访客身份登录,我可以 cd 到秘密目录并查看(和编辑)它的内容:

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.

那么,为什么来宾可以访问我的文件,我做错了什么?

先感谢您!

4

1 回答 1

3

sshfs 默认不允许内核检查权限

你需要使用

sshfs -o allow_other,default_permissions

我不确定如何将它与 autofs 一起使用,因为我只直接使用 sshfs 但它应该能够插入某个位置

于 2013-06-25T22:13:49.833 回答