本文翻译自:Chmod 777 to a folder and all contents [duplicate]

This question already has an answer here: 这个问题在这里已有答案:

  • How do I change permissions for a folder and all of its subfolders and files in one step in Linux? 如何在Linux中一步更改文件夹及其所有子文件夹和文件的权限? [closed] 16 answers [已关闭] 16个答案

I have a web directory /www and a folder in that directory called store . 我有一个web目录/www和该目录中名为store的文件夹。

Within store are several files and folders. store有几个文件和文件夹。 I want to give the folder store and all files and folders within the store folder all permissions. 我想给文件夹store和中的所有文件和文件夹store文件夹的所有权限。

How do I do this? 我该怎么做呢? I am guessing via .htaccess. 我猜是通过.htaccess。


#1楼

参考:https://stackoom.com/question/YwcL/Chmod-到一个文件夹和所有内容-重复


#2楼

You can also use chmod 777 * 你也可以使用chmod 777 *

This will give permissions to all files currently in the folder and files added in the future without giving permissions to the directory itself. 这将为文件夹中的所有文件和将来添加的文件授予权限,而不授予对目录本身的权限。

NOTE: This should be done in the folder where the files are located. 注意:这应该在文件所在的文件夹中完成。 For me it was an images that had an issue so I went to my images folder and did this. 对我来说这是一个有问题的图像所以我去了我的图像文件夹并做了这个。


#3楼

Yes, very right that the -R option in chmod command makes the files/sub-directories under the given directory will get 777 permission. 是的,非常正确的是chmod命令中的-R选项使得给定目录下的文件/子目录将获得777权限。 But generally, it's not a good practice to give 777 to all files and dirs as it can lead to data insecurity. 但一般来说,为所有文件和目录提供777并不是一个好习惯,因为它可能导致数据不安全。 Try to be very specific on giving all rights to all files and directories. 尝试非常具体地赋予所有文件和目录的所有权利。 And to answer your question: 并回答你的问题:

chmod -R 777 your_directory_name

... will work ... 将工作


#4楼

for mac, should be a 'superuser do'; 对于mac,应该是'超级用户做';

so first : 首先:

sudo -s
password:

and then 然后

chmod -R 777 directory_path

#5楼

You can give permission to folder and all its contents using option -R ie Recursive permissions. 您可以使用选项-R即递归权限授予文件夹及其所有内容的权限。

But I would suggest not to give 777 permission to all folder and it's all contents. 但我建议不要给所有文件夹777权限,这是所有内容。 You should give specific permission to each sub-folder in www directory folders. 您应该为www目录文件夹中的每个子文件夹授予特定权限。

Ideally, give 755 permission for security reasons to the web folder. 理想情况下,出于安全原因,请将755权限授予Web文件夹。

sudo chmod -R 755 /www/store

Each number has meaning in permission. 每个号码都有许可含义。 Do not give full permission. 不要完全允许。

N   Description                      ls   binary
0   No permissions at all            ---  000
1   Only execute                     --x  001
2   Only write                       -w-  010
3   Write and execute                -wx  011
4   Only read                        r--  100
5   Read and execute                 r-x  101
6   Read and write                   rw-  110
7   Read, write, and execute         rwx  111
  • First Number 7 - Read, write, and execute for the user. 第一个数字7 - 用户的读,写和执行。
  • Second Number 5 - Read and execute for the group. 第二个数字5 - 读取并执行该组。
  • Third Number 5 - Read and execute for others. 第三号码 - 为他人阅读和执行。

If your production web folder has multiple users, then you can set permissions and user groups accordingly. 如果您的生产Web文件夹有多个用户,则可以相应地设置权限和用户组。

More info : 更多信息 :

  1. Understanding File Permissions: What Does “Chmod 777″ Mean? 了解文件权限:“Chmod 777”是什么意思?
  2. What file permissions should I set on web root? 我应该在Web根目录上设置哪些文件权限?
  3. Why shouldn't /var/www have chmod 777 为什么不应该/ var / www有chmod 777

#6楼

This didn't work for me. 这不适合我。

sudo chmod -R 777 /path/to/your/file/or/directory

I used -f also. 我用-f也。

sudo chmod -R -f 777 /path/to/your/file/or/directory

Chmod 777到一个文件夹和所有内容[重复]相关推荐

  1. python如何创建一个文件夹_利用Python怎么创建一个文件夹

    利用Python怎么创建一个文件夹 发布时间:2020-12-08 14:48:04 来源:亿速云 阅读:91 作者:Leah 这期内容当中小编将会给大家带来有关利用Python怎么创建一个文件夹,文 ...

  2. linux桌面上创建文件夹,如何在桌面上创建一个文件夹_在桌面上建立文件夹的方法...

    有些朋友会习惯把文件资料放到桌面,时间久了之后,文件越来越多,这时就需要把它们整理进文件夹了.那么如何在桌面上创建一个文件夹呢?今天小编就为大家带来在桌面上建立文件夹的方法. 在桌面上建立文件夹的方法 ...

  3. 每打开一个文件夹就会出现一个新窗口

    我的ie浏览器打不开了,我就把ie卸载了又安装,不但ie没好,连打开一个文件夹下面的内容都会出现很多窗口,明明就想打开一个文件 结果出好多窗口,现在终于弄好了,把方法记下来,以防再坏! 1. 开始-〉 ...

  4. Win7,每打开一个文件夹,都会在新窗口中打开

    我的ie浏览器打不开了,我就把ie卸载了又安装,不但ie没好,连打开一个文件夹下面的内容都会出现很多窗口,明明就想打开一个文件 结果出好多窗口,现在终于弄好了,把方法记下来,以防再坏! 1. 开始-〉 ...

  5. linux 返回上一个文件夹_常用命令之linux指令

    无论是在服务器上进行开发,还是在 android 上执行一些指令,都需要用到 linux 的一些命令行操作,所以,必须要学习一些 linux 指令的基本操作. 下面是我整理的一些 linux 基本操作 ...

  6. 新建一个文件夹服务器,云服务器中新建文件夹命令

    云服务器中新建文件夹命令 内容精选 换一换 部署提供可视化.一键式部署服务,支持并行部署和流水线无缝集成,实现部署环境标准化和部署过程自动化.本节通过以下五步介绍如何使用部署服务将项目代码部署到云主机 ...

  7. linux修改文件夹的访问权限,linux setfacl chmod g+s 修改文件夹和文件的默认访问权限和所属组...

    linux setfacl chmod g+s 修改文件夹和文件的默认访问权限和所属组 我们在创建一个文件夹或者一个文件的时候,希望集成父文件夹的访问权限和组 修改默认访问权限 setfacl 以及 ...

  8. sh脚本每天创建一个文件夹_我每天创建一个月的视频。 这就是发生的事

    sh脚本每天创建一个文件夹 At the end of 2019 I promised that 2020 would be all about my YouTube channel. So that ...

  9. python读取一个文件夹/子文件夹下的所有文件名字

    python读取一个文件夹/子文件夹下的所有文件名字 示例代码: import osfile_path = './images/' all_file_name = os.listdir(file_pa ...

最新文章

  1. 【记录】入选《开发工具领域内容榜》第6名
  2. c++ 初始化 代码 应放在那里_Go语言goroutine调度器初始化 (12)
  3. Python与MySQL的交互
  4. 在Windows XP下,安装VS 2010 Express For Windows Phone .
  5. 计算机桌面怎么换服,电脑管家桌面整理怎么更换电脑壁纸?
  6. 这真不是网友P的图?雷军微博曝光小米9 SE真机图 彩虹小米有点炫酷
  7. java文件虚拟路径_java虚拟路径的总结
  8. usionCharts 技术文档-Jsp画图
  9. python的装饰器、迭代器、yield_python的装饰器,迭代器,生成器(yield)
  10. C3P0连接池的配置方式
  11. 动态分区分配算法(1、首次适应算法 2、最佳适应算法 3、最坏适应算法 4、邻近适应算法)
  12. 卷积码编码器matlab,卷积码的编解码matlab仿真.doc
  13. 如何通过DOI号来获取相关文献并下载?
  14. php将ppt转jpg图片的具体步骤代码
  15. Win10 突破20%共享大关
  16. Swing 美化包-JTattoo
  17. 移动WEB学习 - 字体图标、平面转换、渐变
  18. 基于人工智能的滚动轴承PHM方法综述
  19. KITTI数据集-百度云盘
  20. Acer Aspire sw5-12安装系统(包含所有资源)|Acer sw系列装系统

热门文章

  1. Tomcat 的 catalina.out 日志分割
  2. 安卓高手之路 图形系统(3 底层SurfceFlinger系统)
  3. Android FrameWork——Touch事件派发过程详解
  4. 算法--------打家劫舍(动态规划,Java版本)
  5. https refused 解决方法
  6. Android 微信支付详解与Demo
  7. php insert into values 可以是数组吗,PHP INSERT INTO插入不了数据有关问题
  8. 使用Storm实现WordCount
  9. (0036) iOS 开发之HTTPS、SSL验证
  10. 「PKUWC2018」Minimax