我试图让我的文件夹属于“Apache”,然后chmod该文件夹,以便只有所有者和组可以访问它。 我正在尝试这样做,以防止访问者直接执行用户上传的文件。 这里是我正在使用的命令:
chown -R apache uploads chmod -R 770 uploads
资料来源: http : //www.mysql-apache-php.com/fileupload-security.htm
相反,它似乎虽然让访问者看不到这些文件,但却不允许apache提供这些文件。 你有什么想法?
主要如上所述:
如果要排除组“users”的所有用户访问“upload”-dir,则可以明确指定该目录以将“users”分组,然后设置限制性组权限:
# group permissions override permissions for "others" chown -R www-data:users /mydir # group has no permissions, "others" can read and traverse chmod 0705 /mydir # change permissions on subdirs only find /mydir -type d -exec chmod 0705 {} \; # files should by default not be executeable anyway find /mydir -type f -exec chmod ax,ow {} \;
如果您想查找apache用户,请执行(仅适用于Linux)
ps axu | grep apache | grep -v root
并看看最左边的一列。 也许在grep命令中用httpdreplaceapache。 干杯,
聂。
世界位需要只读。 尝试chmod -R 774 uploads 。
还应该先阅读文件。 :)看起来像770应该工作。 确保apache守护进程用户和组自己上传。 组的一部分是非常重要的,通过networking浏览器提供的文件。