Apache服务器 - 如何写目录/文件设定在755,而不是777权限 [英] Apache Webserver - How to write to dir/files with permissions set at 755 instead of 777

查看:1050
本文介绍了Apache服务器 - 如何写目录/文件设定在755,而不是777权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚学会在我的Ubuntu Linux操作系统的本地主机首次安装Apache 2。我使其与PHP5工作。

I just learned to install Apache 2 on my ubuntu linux localhost for the first time. I'm making it work with PHP5.

我注意到,只要我想要写一个文件或目录,我和chmod 777目标。

I noticed that anytime I want to write to a file or directory, I have to chmod 777 the destination.

但是从我的经验,致力于托管解决方案的第三方,一般我可以写到具有755权限的文件,并显示目录。

But from my experience working on 3rd party hosting solutions, I am generally allowed to write to files and dirs that have 755 permissions.

我可以做在我的本地什么,这样我可以写入文件,并显示目录755权限?如果这个问题的答案很长,能有人给我一个链接到一个一步一步的指导,以做到这一点?

What can I do on my localhost so that I can write to files and dirs with 755 permissions? If the answer to this is very long, can someone send me a link to a step by step guide to do this?

推荐答案

您可能无法做到这一点,因为文件的所有者是比用户试图执行对文件的操作不同。

You probably can't achieve this because the owner of the file is different than the user trying to perform an action on the file.

的权限是:

所有者组 - 每个人

rwx-rwx-rwx

i.e.  111 = 7 which allows read/write and execute.  
101 = 5 which is just read and execute

您不能写入到文件中的用户,因为你的登录不能够访问该文件的所有者/组的一部分。

you can't write to the file because your logged in user isn't part of the owner/group that has access to the file.

最后7(即RWX-RWX-111(7))是指全球范围内,每个人都读该文件/写访问。

the final 7 (i.e. rwx-rwx-111(7)) means that globally, everyone has read/write access to that file.

如何解决这个问题

在Linux中,你可以使用chown或chgrp命令命令来实现你想要的结果。

how to fix this
In Linux, you can use the chown or chgrp command to achieve your desired results.

这篇关于Apache服务器 - 如何写目录/文件设定在755,而不是777权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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