WordPress: Changing File Permissions:修订间差异

来自站长百科
跳转至: 导航、​ 搜索
无编辑摘要
 
(未显示同一用户的14个中间版本)
第1行: 第1行:
On computer filesystems, different files and directories have <strong>permissions</strong> that specify who and what can edit and read them. This is important because WordPress may need access to write to files in your <code>wp-content</code> directory to enable certain functions.
在电脑文件系统中,不同的文件和不同的目录有权限规定谁和什么东西可以编辑和阅读它们。这很重要因为WordPress也许需要有权限在你的wp-content上写文件以确保一些特别的功能。


Here is one possible permission scheme.
下面是一个可能的权限方案。
所有的文件应该由你的用户账户拥有,而且可以由你写。任何需要来自WordPress写权限的文件,应该由网络服务器使用的用户账户集体拥有。
* 根WordPress目录:所有的文件只有你的用户账户才可以使用。
** 除<strong><code>.htaccess</code></strong> 之外,如果你想WordPress为你自动产生重写功能
* <code>/wp-admin/</code>-WordPress 管理区域:所有的文件只有你的用户账户才可以写。
* <code>/wp-includes/</code> - WordPress应用逻辑的大部分:所有的文件只有你的用户账户才可以写。
* <code>/wp-images/</code> - WordPress 使用的图像文件:所有的文件只有你的用户账户才可以使用。
** <code>/wp-content/themes/</code> - 主题文件。如果你想使用内置的主题编辑器,所有的文件需要集合起来而且是可写的。如果你不想使用内置的编辑器,所有的文件只有你的用户账户才可以写。
** <code>/wp-content/plugins/</code> - 插件文件:所有的文件只有你的用户账户才可以使用。
** <code>/wp-content/</code>下面的其它目录应该由任何需要它们的插件/主题记录。权限会有不同。
** The WordPress数据库文件备份插件需要<code>/wp-content/</code> 文件夹可写。在有些情况下,这可能需要上交755个权限或者更多,(例如有些主机上777个权限)。
在这个论坛 thread上也可以看看这方面的讨论.


All files should be owned by your user account, and should be writable by you.  Any file that needs write access from WordPress should be group-owned by the user account used by the webserver.


* <code>/</code> - The root Wordpress directory: all files should be writable only by your user account
== 使用一个FTP帐户 ==
** EXCEPT <strong><code>.htaccess</code></strong> if you want WordPress to automatically generate rewrite rules for you
* <code>/wp-admin/</code> - the WordPress administration area:  all files should be writable only by your user account.
* <code>/wp-includes/</code> - the bulk of WordPress application logic: all files should be writable only by your user account.
* <code>/wp-images/</code> - image files used by WordPress: all files should be writable only by your user account.
* <code>/wp-content/</code> - variable user-supplied content
** <code>/wp-content/themes/</code> - theme files.  If you want to use the built-in theme editor, all files need to be group writable.  If you do not want to use the built-in theme editor, all files can be writable only by your user account
** <code>/wp-content/plugins/</code> - plugin files: all files should be writable only by your user account.
** other directories under <code>/wp-content/</code> should be documented by whatever plugin / theme requires them.  Permissions will vary.
** The WordPress Database Backup Plugin requires the <code>/wp-content/</code> folder be made writeable. In some cases, this may require assigning 755 permissions or higher (e.g. 777 on some hosts).


Also see the discussion in this [http://wordpress.org/support/topic/50863|Support Forum thread].
FTP程序(“客户端”)允许你为你的远程主机上的文件和目录设置权限. 这个功能通常称为chmod或者在程序菜单上设定权限.
在一个WordPress安装上,你也许想改变的两个文件是索引页和控制布局的css.下面是你怎样改变index.php-这个过程对于任何文件来说,都是相同的.In 在下面的屏幕截图中,看一下最后的一栏-那显示了权限.它看起来有些混乱,但现在仅仅看看字母的序列.
<br >
[[WordPress:Image:podz_filezilla_12.gif|center|thumb|400px| 最初的权限]
点击”index.php”并且选择”文件权限”<br >
一个界面会跳出来.
[[WordPress:Image:podz_filezilla_13.gif|center|thumb|305px| 改变文件权限]


== Using an FTP Client ==
不用担心选框.只要删除”数值”:输入你需要的数字-这个例子中是666.然后点击OK.
<br >
[[WordPress:Image:podz_filezilla_14.gif|center|thumb|400px|权限已经被更改了.]
现在你可以看到文件的权限已经被更改了.


FTP programs ("clients") allow you to set permissions for files and directories on your remote host. This function is often called <code>chmod</code> or <code>set permissions</code> in the program menu.
===打开隐藏文件===


In a [[WordPress:Installing_WordPress|WordPress install]], two files that you will probably want to alter are the index page, and the css which controls [[WordPress:Blog_Design_and_Layout|the layout]]. Here's how you change index.php - the process is the same for any file.
在默认情况下,大多的FTP客户端,包括[http://filezilla.sourceforge.net/ FileZilla], 保存有隐藏的文件,这些文件从开始展示时,便以一个标点符号(.)开始.但是,在有些情况下,你可能要看看你的隐藏的文件,这样你就可以在那个文件上更改一下权限.比如,你可能要使你的.htaccess文件,控制permalinks的文件,可写.
In the screenshot below, look at the last column - that shows the permissions. It looks a bit confusing, but for now just note the sequence of letters.
<br />
[[WordPress:Image:podz_filezilla_12.gif|center|thumb|400px|Initial permissions]]


Right-click 'index.php' and select 'File Permissions'<br />
在FileZilla上展示隐藏的文件,从顶层目录上选择”查看”,然后选择”显示隐藏文件”是必要的.展示文件的界面会刷新,任何以前隐藏的文件都会展现在你的面前
A popup screen will appear.
让FileZilla总是显示隐藏文件,-在编辑,设置,远程文件列表,选中总是显示隐藏文件框.
[[WordPress:Image:podz_filezilla_13.gif|center|thumb|305px|Altering file permissions]]


Don't worry about the check boxes. Just delete the 'Numeric value:' and enter the number you need - in this case it's 666. Then click OK.
==使用命令行==
<br />
[[WordPress:Image:podz_filezilla_14.gif|center|thumb|400px|Permissions have been altered]]
You can now see that the file permissions have been changed.


===Unhide the hidden files===
如果你有shell/SSH权限使用你的主机账户,你可以使用<code>chmod</code>来改变文件权限.在你使用<code>chmod</code>之前,建议你阅读一些例如这个以及手册之类的教程[http://www.washington.edu/computing/unix/permissions.html this] and also the [http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/chmod.1.html manual page]来确保你自己更了解怎样使用.
你可以分两步使你的wp-内容目录中的所有的文件可写:
# 以一个类似cd wordpress/的命令来进入你的WordPress的主目录.
# 输入<code>chmod -R 777 wp-content</code> 这是什么意思?<code>chmod</code>是一种多用户操作系统的命令,意思是在一个文件上”改变模式”.-Rflag意思是在<code>wp-content</code>中所有的文件和目录中做一些改变.777是我们将目录更改的一个模式,意思是目录在WordPress上是可读可写的.最后我们有了我们要修改的目录名<code>wp-content</code>.
如果你使用Permalinks,你也应该改变.htaccess权限,来确保当你改变设置或者增加一些新的网页的时候(这些需要是当Permalinks可以用的时候,文件能更新),WordPress能够更新.
# 看WordPress的主要目录
# 输入<code>chmod 666 .htaccess</code>
注意Filezilla是非常好的FTP客户端.你可以从download.com中将它下载下来.


By default, most [[WordPress:FTP_Clients|FTP Clients]], including [http://filezilla.sourceforge.net/ FileZilla], keep hidden files, those files beginning with a period (.), from being displayed.  But, at some point, you may need to see your hidden files so that you can change the permissions on that file.  For example, you may need to make your [[WordPress:Glossary#.htaccess|.htaccess]] file, the file that controls [[WordPress:Using Permalinks|permalinks]], writeable. 
== 还看看 ==


To display hidden files in FileZilla, in it is necessary to select 'View' from the top menu, then select 'Show hidden files'.  The screen display of files will refresh and any previously hidden file should come into view.
[[WordPress:htaccess for subdirectories|为子目录的htaccess]]
 
To get FileZilla to always show hidden files - under Edit, Settings, Remote File List, check the Always show hidden files box.
 
== Using the Command Line ==
 
If you have shell/SSH access to your hosting account, you can use <code>chmod</code> to change file permissions. Before you start using <code>chmod</code> it would be recommended to read some tutorial like [http://www.washington.edu/computing/unix/permissions.html this] and also the [http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/chmod.1.html manual page] to make sure you understand better what you can make with it.
 
You can make all the files in your <code>wp-content</code> directory writable in two steps:
 
# Go to your WordPress main directory, with a command like <code>cd wordpress/</code>
# Enter <code>chmod -R 777 wp-content</code>
 
What does this mean? <code>chmod</code> is a unix command that means "<strong>ch</strong>ange <strong>mod</strong>e" on a file. The <code>-R</code> flag means to apply the change to every file and directory inside of <code>wp-content</code>. 777 is the mode we are changing the directory to, it means that the directory is readable and writable by WordPress. Finally, we have the name of the directory we are going to modify, <code>wp-content</code>.
 
 
If you use Permalinks you should also change permissions of .htaccess to make sure that WordPress can update it when you change settings or add some new Page (which requires update of the file to work when Permalinks are enabled).
 
# Go to the main directory of WordPress
# Enter <code>chmod 666 .htaccess</code>
 
Note that Filezilla is a very good FTP client. You can download it from download.com
 
 
 
== See also ==
 
[[WordPress:htaccess for subdirectories]]

2008年3月26日 (三) 14:56的最新版本

在电脑文件系统中,不同的文件和不同的目录有权限规定谁和什么东西可以编辑和阅读它们。这很重要因为WordPress也许需要有权限在你的wp-content上写文件以确保一些特别的功能。

下面是一个可能的权限方案。 所有的文件应该由你的用户账户拥有,而且可以由你写。任何需要来自WordPress写权限的文件,应该由网络服务器使用的用户账户集体拥有。

  • 根WordPress目录:所有的文件只有你的用户账户才可以使用。
    • .htaccess 之外,如果你想WordPress为你自动产生重写功能
  • /wp-admin/-WordPress 管理区域:所有的文件只有你的用户账户才可以写。
  • /wp-includes/ - WordPress应用逻辑的大部分:所有的文件只有你的用户账户才可以写。
  • /wp-images/ - WordPress 使用的图像文件:所有的文件只有你的用户账户才可以使用。
    • /wp-content/themes/ - 主题文件。如果你想使用内置的主题编辑器,所有的文件需要集合起来而且是可写的。如果你不想使用内置的编辑器,所有的文件只有你的用户账户才可以写。
    • /wp-content/plugins/ - 插件文件:所有的文件只有你的用户账户才可以使用。
    • /wp-content/下面的其它目录应该由任何需要它们的插件/主题记录。权限会有不同。
    • The WordPress数据库文件备份插件需要/wp-content/ 文件夹可写。在有些情况下,这可能需要上交755个权限或者更多,(例如有些主机上777个权限)。

在这个论坛 thread上也可以看看这方面的讨论.


使用一个FTP帐户[ ]

FTP程序(“客户端”)允许你为你的远程主机上的文件和目录设置权限. 这个功能通常称为chmod或者在程序菜单上设定权限. 在一个WordPress安装上,你也许想改变的两个文件是索引页和控制布局的css.下面是你怎样改变index.php-这个过程对于任何文件来说,都是相同的.In 在下面的屏幕截图中,看一下最后的一栏-那显示了权限.它看起来有些混乱,但现在仅仅看看字母的序列.
[[WordPress:Image:podz_filezilla_12.gif|center|thumb|400px| 最初的权限] 点击”index.php”并且选择”文件权限”
一个界面会跳出来. [[WordPress:Image:podz_filezilla_13.gif|center|thumb|305px| 改变文件权限]

不用担心选框.只要删除”数值”:输入你需要的数字-这个例子中是666.然后点击OK.
[[WordPress:Image:podz_filezilla_14.gif|center|thumb|400px|权限已经被更改了.] 现在你可以看到文件的权限已经被更改了.

打开隐藏文件[ ]

在默认情况下,大多的FTP客户端,包括FileZilla, 保存有隐藏的文件,这些文件从开始展示时,便以一个标点符号(.)开始.但是,在有些情况下,你可能要看看你的隐藏的文件,这样你就可以在那个文件上更改一下权限.比如,你可能要使你的.htaccess文件,控制permalinks的文件,可写.

在FileZilla上展示隐藏的文件,从顶层目录上选择”查看”,然后选择”显示隐藏文件”是必要的.展示文件的界面会刷新,任何以前隐藏的文件都会展现在你的面前 让FileZilla总是显示隐藏文件,-在编辑,设置,远程文件列表,选中总是显示隐藏文件框.

使用命令行[ ]

如果你有shell/SSH权限使用你的主机账户,你可以使用chmod来改变文件权限.在你使用chmod之前,建议你阅读一些例如这个以及手册之类的教程this and also the manual page来确保你自己更了解怎样使用. 你可以分两步使你的wp-内容目录中的所有的文件可写:

  1. 以一个类似cd wordpress/的命令来进入你的WordPress的主目录.
  2. 输入chmod -R 777 wp-content 这是什么意思?chmod是一种多用户操作系统的命令,意思是在一个文件上”改变模式”.-Rflag意思是在wp-content中所有的文件和目录中做一些改变.777是我们将目录更改的一个模式,意思是目录在WordPress上是可读可写的.最后我们有了我们要修改的目录名wp-content.

如果你使用Permalinks,你也应该改变.htaccess权限,来确保当你改变设置或者增加一些新的网页的时候(这些需要是当Permalinks可以用的时候,文件能更新),WordPress能够更新.

  1. 看WordPress的主要目录
  2. 输入chmod 666 .htaccess

注意Filezilla是非常好的FTP客户端.你可以从download.com中将它下载下来.

还看看[ ]

为子目录的htaccess