chmod 777 到文件夹和所有内容

发布于 2024-12-18 22:54:51 字数 209 浏览 1 评论 0原文

我有一个 Web 目录 /www 以及该目录中一个名为 store 的文件夹。

store 内有几个文件和文件夹。我想授予文件夹 store 以及 store 文件夹中的所有文件和文件夹所有权限。

我该怎么做?我猜是通过.htaccess。

I have a web directory /www and a folder in that directory called store.

Within store are several files and folders. I want to give the folder store and all files and folders within the store folder all permissions.

How do I do this? I am guessing via .htaccess.

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

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

发布评论

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

评论(7

笨死的猪 2024-12-25 22:54:51

如果您要使用控制台命令,则为:

chmod -R 777 /www/store-R(或--recursive)选项使其递归。

或者,如果您想让当前目录中的所有文件具有所有权限,请输入:

chmod -R 777 ./

如果您需要有关 chmod 命令的更多信息,请参阅:文件权限

If you are going for a console command it would be:

chmod -R 777 /www/store. The -R (or --recursive) options make it recursive.

Or if you want to make all the files in the current directory have all permissions type:

chmod -R 777 ./

If you need more info about chmod command see: File permission

我是男神闪亮亮 2024-12-25 22:54:51

如果您所说的所有权限是指 777

导航到文件夹并

chmod -R 777 .

If by all permissions you mean 777

Navigate to folder and

chmod -R 777 .
泛滥成性 2024-12-25 22:54:51

您可以使用选项 -R 授予文件夹及其所有内容的权限,即递归权限。

但我建议不要授予所有文件夹及其所有内容的 777 权限。您应该为 www 目录文件夹中的每个子文件夹授予特定权限。

出于安全原因,最好为 Web 文件夹授予 755 权限。

sudo chmod -R 755 /www/store

每个数字在许可中都有意义。不要给予完全许可。

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
  • 第一个数字 7 - 为用户读取、写入和执行。
  • 第二个数字 5 - 为小组阅读并执行。
  • 第三个数字 5 - 为他人阅读并执行。

如果您的生产 Web 文件夹有多个用户,那么您可以相应地设置权限和用户组。

更多信息:

  1. 了解文件权限:“Chmod 777”是什么意思?
  2. 应该有哪些文件权限我设置为网络根目录?
  3. 为什么不应该/var/www 有 chmod 777

You can give permission to folder and all its contents using option -R i.e Recursive permissions.

But I would suggest not to give 777 permission to all folder and it's all contents. You should give specific permission to each sub-folder in www directory folders.

Ideally, give 755 permission for security reasons to the web folder.

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.
  • Second Number 5 - Read and execute for the group.
  • 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.

More info :

  1. Understanding File Permissions: What Does “Chmod 777″ Mean?
  2. What file permissions should I set on web root?
  3. Why shouldn't /var/www have chmod 777
捎一片雪花 2024-12-25 22:54:51

您还可以使用chmod 777 *

这将授予文件夹中当前所有文件以及将来添加的文件的权限,而不授予目录本身的权限。

注意:这应该在文件所在的文件夹中完成。对我来说,这是一个有问题的图像,所以我转到我的图像文件夹并执行了此操作。

You can also use 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.

贩梦商人 2024-12-25 22:54:51

是的,非常正确,chmod命令中的-R选项使给定目录下的文件/子目录将获得777权限。但一般来说,为所有文件和目录提供 777 并不是一个好的做法,因为它可能会导致数据不安全。尝试非常具体地授予所有文件和目录的所有权限。并回答你的问题:

chmod -R 777 your_directory_name

...会起作用

Yes, very right that the -R option in chmod command makes the files/sub-directories under the given directory will get 777 permission. But generally, it's not a good practice to give 777 to all files and dirs as it can lead to data insecurity. 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

忘年祭陌 2024-12-25 22:54:51

对于 Mac,应该是“超级用户执行的操作”;

所以首先:

sudo -s 
password:

然后

chmod -R 777 directory_path

for mac, should be a ‘superuser do’;

so first :

sudo -s 
password:

and then

chmod -R 777 directory_path
九八野马 2024-12-25 22:54:51

这对我不起作用。

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

我也使用了 -f

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

This didn't work for me.

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

I used -f also.

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