什么是正常的chmod? [英] What is the normal chmod?

查看:23
本文介绍了什么是正常的chmod?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的网络服务器上,我的文件权限到处都是,我想将所有内容重置"回原来的状态.我不希望任何用户能够进入并从我的 Web 服务器上删除内容!我只是希望他们能够查看 php 页面等.

On my web server, my file permissions are all over the place and I want to 'reset' everything back to how it originally was. I don't want any users to be able to come in and delete things off my web server! I just want them to be able to look at php pages etc.

我应该使用什么 chmod?

What chmod should I use?

推荐答案

这是我收集的总结

  • chmod 所有文件644
  • chmod 所有 .htaccess 文件到 644
  • chmod 所有 robots.txt 文件到 644
  • chmod 所有目录711
  • 将所有目录目录列表(.htaccess选项+索引)修改为755
  • chmod 用户可以上传文件的所有目录755(例如:/uploads/).
  • chmod all files to 644
  • chmod all .htaccess files to 644
  • chmod all robots.txt files to 644
  • chmod all directories to 711
  • chmod all directories with directory listing (.htaccess Options +Indexes) to 755
  • chmod all directories that users can upload files to, to 755 (ex: /uploads/).

说明:

  • 644 表示:
    • 6:文件/目录的所有者可以,但不能执行.由于文件不可执行,因此您无需在此处拥有x"权限(6 表示 r+w.7 表示 r+w+x).
    • 44:文件/目录所属的(使用ls -l查看组)和其他人(public) 能够读取文件,但不能执行或写入文件(权限编号 4).
    • 644 means:
      • 6: the owner of the file/directory can read and write, but not execute. Since files are not executable, you don't need to have "x" rights here (6 means r+w. 7 means r+w+x).
      • 44: The group that the file/directory belongs to (see the group by using ls -l) and everyone else (the public) are able to read the file, but not execute or write to it (permission number 4).
      • 7:文件/目录的所有者可以读取写入执行.这是目录所必需的!当您尝试列出目录时,如果没有执行",您将获得权限被拒绝.
      • 11:文件/目录所属的公共只有执行权限.这适用于您不希望其他人浏览内容但希望让他们访问目录下所选文件的目录.
      • 7: the owner of the file/directory can read, write, and execute. This is needed for directories! Without "execute" when you try to list the directory you'll get permission denied.
      • 11: The group that the file/directory belongs to and the public have execute rights only. This is suitable for directories where you don't want other people browsing through the contents but do want to give them access to selected files further down the directory.
      • 7:文件/目录的所有者可以读取写入执行.莉>
      • 55:文件/目录所属的公共具有读取执行权限但不写.这使用户能够查看目录中的文件,并能够读取这些文件,但不能更改它们.
      • 7: the owner of the file/directory can read, write, and execute.
      • 55: The group that the file/directory belongs to and the public have read and execute permissions but not write. This allows users to be able to view what files are in a directory, and be able to read those files, but not alter them.

      还有一个交互式在线计算器,您可以用来确定要使用的权限:https://chmod-calculator.com/

      There's also an interactive online calculator you can use to figure out what permissions to use: https://chmod-calculator.com/

      这篇关于什么是正常的chmod?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆