<i id='x9EcJ'><tr id='x9EcJ'><dt id='x9EcJ'><q id='x9EcJ'><span id='x9EcJ'><b id='x9EcJ'><form id='x9EcJ'><ins id='x9EcJ'></ins><ul id='x9EcJ'></ul><sub id='x9EcJ'></sub></form><legend id='x9EcJ'></legend><bdo id='x9EcJ'><pre id='x9EcJ'><center id='x9EcJ'></center></pre></bdo></b><th id='x9EcJ'></th></span></q></dt></tr></i><div id='x9EcJ'><tfoot id='x9EcJ'></tfoot><dl id='x9EcJ'><fieldset id='x9EcJ'></fieldset></dl></div>
    1. <tfoot id='x9EcJ'></tfoot>
      1. <legend id='x9EcJ'><style id='x9EcJ'><dir id='x9EcJ'><q id='x9EcJ'></q></dir></style></legend>

        <small id='x9EcJ'></small><noframes id='x9EcJ'>

          <bdo id='x9EcJ'></bdo><ul id='x9EcJ'></ul>

        Unix 权限,读取与执行(PHP 上下文)

        Unix permissions, read vs. execute (PHP context)(Unix 权限,读取与执行(PHP 上下文))
          <tbody id='TPhpG'></tbody>
            • <tfoot id='TPhpG'></tfoot>

                • <bdo id='TPhpG'></bdo><ul id='TPhpG'></ul>

                  <i id='TPhpG'><tr id='TPhpG'><dt id='TPhpG'><q id='TPhpG'><span id='TPhpG'><b id='TPhpG'><form id='TPhpG'><ins id='TPhpG'></ins><ul id='TPhpG'></ul><sub id='TPhpG'></sub></form><legend id='TPhpG'></legend><bdo id='TPhpG'><pre id='TPhpG'><center id='TPhpG'></center></pre></bdo></b><th id='TPhpG'></th></span></q></dt></tr></i><div id='TPhpG'><tfoot id='TPhpG'></tfoot><dl id='TPhpG'><fieldset id='TPhpG'></fieldset></dl></div>
                  <legend id='TPhpG'><style id='TPhpG'><dir id='TPhpG'><q id='TPhpG'></q></dir></style></legend>

                  <small id='TPhpG'></small><noframes id='TPhpG'>

                  本文介绍了Unix 权限,读取与执行(PHP 上下文)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个需要连接到数据库的 php 脚本.数据库的凭据存储在另一个 php 脚本中.

                  I have a php script which needs to connect to a database. The credentials for the database are stored in another php script.

                  如果我将凭据文件的权限设置为 661,以便 Public 具有执行权限但没有读取权限,这是否允许主脚本访问凭据并连接到数据库,同时防止有人在服务器上拥有用户帐户从查看凭据文件的内容?

                  If I set the permissions for the credentials file to 661 so that Public has execute permission but not read permission, does this allow the main script to access the credentials and connect to the DB while preventing someone with a user account on the server from viewing the contents of the credentials file?

                  我想我对读取和执行之间的区别感到困惑.php 脚本(以 www 或类似方式运行)是否需要读取权限才能包含另一个 php 脚本并使用其中的任何内容?还是只需要执行?读取权限是否隐式赋予执行权限?

                  I guess I'm confused as to the distinction between read and execute. Does a php script (running as www or something similar) need read-permission to include another php script and use any content inside? Or does it just need execute? Does read permission implicitly give execute permission?

                  子问题:如果我将所有脚本设置为仅具有执行权限而不具有读取权限,是否会出现任何陷阱?这是假设我将需要显式读取权限(数据文件)的所有文件设置为读取.

                  Sub-Question: If I set all of my scripts to only have execute permission and not read, are there any pitfalls I should expect? This is assuming that I will leave any files I need explicit read permission (data files) set to read.

                  推荐答案

                  就文件而言,执行权限与您无关 - 您的 Web 服务器运行的用户帐户需要访问和读取相关文件的权限.为了遍历目录,用户还需要对该目录的执行权限.

                  As far as files are concerned, execute permission is irrelevant to you - the user account your web server is running under needs permission to access and read the files in question. In order to traverse into a directory, the user will also require execute permission on that directory.

                  如果你试图让你的脚本被网络服务器读取(假设你以属于www"组的帐户www"运行),而不是系统上的其他用户,这就是我会做(假设您的帐户是myuser"):

                  If you are trying to make your scripts readable by the web server (let's say you're running as the account "www" which belongs to group "www"), and not by other users on the system, here's what I would do (assumes your account is "myuser"):

                  # Change owner to "myuser" and group to "www" for file(s) in question
                  chown myuser:www config.php
                  
                  # 640: myuser has rw-, www has r--, world has ---
                  chmod 640 config.php
                  

                  如果你想阻止世界读取secrets"目录中的任何文件,只需禁用执行位:

                  If you want to prevent the world from reading any file in a "secrets" directory, just disable the execute bit:

                  # 750: myuser has rwx, www has r-x, world has ---
                  chmod 750 secrets
                  

                  如果您将所有脚本设置为具有执行权限但没有读取权限,则没有人可以对它们做任何有用的事情(包括网络服务器);-)

                  If you set all your scripts to have execute permission but not read permission, nobody can do anything useful with them (including the webserver) ;-)

                  这篇关于Unix 权限,读取与执行(PHP 上下文)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                    • <i id='geRCh'><tr id='geRCh'><dt id='geRCh'><q id='geRCh'><span id='geRCh'><b id='geRCh'><form id='geRCh'><ins id='geRCh'></ins><ul id='geRCh'></ul><sub id='geRCh'></sub></form><legend id='geRCh'></legend><bdo id='geRCh'><pre id='geRCh'><center id='geRCh'></center></pre></bdo></b><th id='geRCh'></th></span></q></dt></tr></i><div id='geRCh'><tfoot id='geRCh'></tfoot><dl id='geRCh'><fieldset id='geRCh'></fieldset></dl></div>
                        <bdo id='geRCh'></bdo><ul id='geRCh'></ul>
                        <legend id='geRCh'><style id='geRCh'><dir id='geRCh'><q id='geRCh'></q></dir></style></legend>

                          <tfoot id='geRCh'></tfoot>

                          <small id='geRCh'></small><noframes id='geRCh'>

                              <tbody id='geRCh'></tbody>