0700或0711权限是否足以保护数据库配置文件?

发布于 2024-11-14 22:09:42 字数 191 浏览 2 评论 0原文

众所周知,通过共享网络托管,如果“其他人”具有(读取)权限,其他用户(网站)的文件可能会泄露给其他人。

我认为 0700 或 0711 权限是保护包含秘密信息的重要文件的最佳方式(在共享主机中)。

我假设服务器正在使用 suPHP 或任何类似的模块,以便保持进程的 UID 与正在访问的文件的所有者相同。

那么你说什么?

As we all know that with shared web hosting other users (websites) files could be revealed to others if 'others' have the (read) permission .

I think 0700 or 0711 permission is the best way( in shared hosting) to protect important files the contain secret information .

I suppose that the server is using suPHP or any similar module so that keep the UID of the process is the same as the owner of the files being accessed.

So what do you say ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

攒眉千度 2024-11-21 22:09:42

你是对的。 700 将确保除了所有者之外,没有人可以读取/写入/执行该文件。这样就足够了!如果要执行它,则为 711,否则为 700。

但是,如果涉及该文件的某些操作失败,则应考虑 711。

编辑:
正如您所提到的,如果它包含连接字符串,您可以安全地假设不需要向任何人授予写入权限,并授予每个人执行权限。
所以,511(即r_x __x __x)应该这样做。

You are correct. 700 would ensure nobody can read/write/execute that file, except the owner. So that would be good enough! In case it is to be executed, 711, else, 700.

However, if some operation involving that file fails, you should consider 711.

EDIT:
As you have mentioned, if it contains a connection string, you can safely assume that nobody needs to be given write privileges, and give everyone execute privileges.
So, 511(which is r_x __x __x) should do it.

人│生佛魔见 2024-11-21 22:09:42

您仅需要目录的执行权限,如果您的文件是 PHP 源文件,那么您当然不需要执行权限。

06402750 通常分别是文件和目录的良好权限(目录权限中的 2 使新文件继承目录的用户和组)。

这适用于文件:

-rw-r-----

和目录

drwxr-s---

如果网络服务器使用组权限并且 FTP 或此类用户是所有者,则这是正确的。使用 Suexec 等,您可以根据谁是所有者和谁是 Web 阅读器(用户?组?)来调整这些设置,Web 阅读器不需要写访问权限,除了根据应用程序可能在某些特定目录上。

并且不要忘记文件和文件。目录权限只是共享环境中用户分离的一点。对于使用每用户open_basedir设置的PHP环境,临时文件上传目录以及每用户会话目录是总是一个好主意(可以在每用户虚拟主机中定义)。

You'll need execution rights only for directories, if your files are PHP source files you certainly do not need execution rights.

0640 and 2750 are usualy good rights for respectively Files and Directories (the 2 in the directory rights make the new files inherit user & group of the directory).

That is for files:

-rw-r-----

And directories

drwxr-s---

Which is right if the webserver is using the group rights and the FTP-or-such user being the owner. With Suexec and such you could maybe adjust these settings depending of who is the owner and who is the web reader (user? group?), the web reader does not need write access, except maybe on some specific directories depending on the application.

And do not forget files & directories rights are only one point in separation of user in a shared envirronment. For PHP envirronments using per-user open_basedir settings, temporary files and upload directories and per-user session directories is always a good idea (that can be defined in per-user virtualhosts).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文