因此,对于我的服务器上托pipe网站的客户,我使用/ home中的标准主文件夹创build用户帐户。
我为所有的collective用户设置了一个SSH监狱,因为我真的反对使用一个单独的FTP服务器。 然后,我安装了ACL,并将acl添加到我的/etc/fstab – 都很好。
/home和chmod 700 ./* 。
setfacl u:www-data:rx ./* 。 我也试过个别目录。 750 。 如何设置ACL以便Apache可以看到托pipe在用户家庭文件夹中的站点AND 2.用户不能在他们家外看到其他人的文件。
编辑:更多细节:
chmod -R 700 ./*后输出chmod -R 700 ./*
sh-3.2# chmod 700 ./* sh-3.2# ls -l total 72 drwx------+ 24 austin austin 4096 Jul 31 06:13 austin drwx------+ 8 jeremy collective 4096 Aug 3 03:22 jeremy drwx------+ 12 josh collective 4096 Jul 26 02:40 josh drwx------+ 8 joyce collective 4096 Jun 30 06:32 joyce
(其他用户不能访问OR apache)
setfacl -mu:www-data:rx jeremy
(现在可以访问成员apache和集体 – 为什么集体呢?)
sh-3.2# getfacl jeremy # file: jeremy # owner: jeremy # group: collective user::rwx user:www-data:rx group::rx mask::rx other::---
解
最终我所做的是:
chmod 755 * setfacl -R -mg::--- * setfacl -R -mu:www-data:rx *
尝试改变面具为“—”?
或者用setfacl撤销组权限。 chmod和setfacl在一起工作不太好 。
那么,你不能阻止用户在没有完整的chroot的情况下看到“他们的主目录之外”,因为他们总是能够看到像/usr/bin这样的系统目录(因为这就是程序运行的方式)。 我不明白你给出的setfacl命令会如何产生显示的结果; 你可以给你的问题的用户的主目录getfacl和ls -l的输出?
对于jailing来说,较新版本的ssh支持ChrootDirectory选项。 对于scp连接,我过去成功地使用scponly 。
至于Apache看到这些文件,你没有得到正确的chmod。 尝试这样的事情(假设Apache使用Apache组):
cd / home
chmod -750 *#拥有者可以做所有事情,组员可以阅读,别人无能为力
chgrp -R apache *#通过将组更改为apache,apache现在可以读取这些文件。
请记住,您不想将常规用户添加到apache组。
hayalci的评论说
chmod和setfacl在一起工作不太好。
帮了很多忙。 我不使用CHMOD来阻止其他组访问数据,而是使用:
cd /home setfacl -mg::0 joeuser # Removes permissions for the owning group. setfacl -mg:www-data:r joeuser # Adds read permissions for Apache cd joeuser/joeuser.com/static/ setfacl -mg:www-data:rwx uploads # So apache can write to the uploads directory.