WordPress: Changing File Permissions:修订间差异

来自站长百科
跳转至: 导航、​ 搜索
(新页面: 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 a...)
 
无编辑摘要
第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.
There are two ways of getting files onto your site, and once there, changing them.


Here is one possible permission scheme.
#By using your cPanel, or whatever file manager is provided by your host.
#By using a FTP client. This guide will show you how to use [http://filezilla.sourceforge.net/ FileZilla].


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.
Why use FileZilla? Because, like WordPress, it is released under the GPL. So, it is not just free, it is staying that way too. FileZilla is also a stable client that works on all flavors of Windows. Need an FTP client for your Mac? Try [http://fetchsoftworks.com/ Fetch], [http://rsug.itd.umich.edu/software/fugu/ Fugu], [http://www.rbrowser.com/RBrowserLite/RBrowserLite.html RBrowserLite], [http://panic.com/transmit/ Transmit], [http://www.crossftp.com/ CrossFTP] or [http://cyberduck.ch/ Cyberduck].


* <code>/</code> - The root Wordpress directory: all files should be writable only by your user account
The FileZilla project homepage is [http://filezilla.sourceforge.net/ http://filezilla.sourceforge.net/] and the download page is [http://sourceforge.net/projects/filezilla/ http://sourceforge.net/projects/filezilla/]At the time of writing, the latest stable version is 2.2.10, and the download is 4.6 MB.  
** 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 filesIf 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].
The following pages will show you how to setup and use Filezilla:


== Using an FTP Client ==
<ol>
<li>[[WordPress:Using_FileZilla|Setting up FileZilla for Your Website]]</li>
<li>[[WordPress:Uploading_WordPress_to_a_remote_host|How to Upload Files and Folders]]</li>
<li>[[WordPress:Changing_File_Permissions|Setting Permissions]]</li>
<li>[[WordPress:Changing_File_Permissions#Unhide_the_hidden_files|Making Hidden Files Visible]]</li>
</ol>


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.
Alternative FTP clients for Windows? Try [http://winscp.net WinSCP], [http://www.smartftp.com/ SmartFTP], [http://www.ftpclient.org/index.htm FTP commander], [http://www.coreftp.com/ CoreFTP], [http://www.crossftp.com/ CrossFTP] or [http://en.wikipedia.org/wiki/Comparison_of_FTP_clients Find more on Wikipedia].
 
In a [[WordPress:WordPress:Installing_WordPress|WordPress install]], two files that you will probably want to alter are the index page, and the css which controls [[WordPress:WordPress:Blog_Design_and_Layout|the layout]]. Here's how you change index.php - the process is the same for any file.
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:WordPress:Image:podz_filezilla_12.gif|center|thumb|400px|Initial permissions]]
 
Right-click 'index.php' and select 'File Permissions'<br />
A popup screen will appear.
[[WordPress: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: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===
 
By default, most [[WordPress: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:WordPress:Glossary#.htaccess|.htaccess]] file, the file that controls [[WordPress: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.
 
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:WordPress:htaccess for subdirectories]]

2008年3月22日 (六) 17:14的版本

There are two ways of getting files onto your site, and once there, changing them.

  1. By using your cPanel, or whatever file manager is provided by your host.
  2. By using a FTP client. This guide will show you how to use FileZilla.

Why use FileZilla? Because, like WordPress, it is released under the GPL. So, it is not just free, it is staying that way too. FileZilla is also a stable client that works on all flavors of Windows. Need an FTP client for your Mac? Try Fetch, Fugu, RBrowserLite, Transmit, CrossFTP or Cyberduck.

The FileZilla project homepage is http://filezilla.sourceforge.net/ and the download page is http://sourceforge.net/projects/filezilla/. At the time of writing, the latest stable version is 2.2.10, and the download is 4.6 MB.

The following pages will show you how to setup and use Filezilla:

  1. Setting up FileZilla for Your Website
  2. How to Upload Files and Folders
  3. Setting Permissions
  4. Making Hidden Files Visible

Alternative FTP clients for Windows? Try WinSCP, SmartFTP, FTP commander, CoreFTP, CrossFTP or Find more on Wikipedia.