You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wiki-changes@httpd.apache.org by Apache Wiki <wi...@apache.org> on 2009/10/29 12:26:26 UTC

[Httpd Wiki] Update of "13PermissionDenied" by pctony

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Httpd Wiki" for change notification.

The "13PermissionDenied" page has been changed by pctony.
The comment on this change is: Odd formatting.
http://wiki.apache.org/httpd/13PermissionDenied?action=diff&rev1=9&rev2=10

--------------------------------------------------

  Typical permissions on a unix-like system for resources not owned by the {{{User}}} or {{{Group}}} specified in {{{httpd.conf}}} would be 644 {{{-rw-r--r--}}} for ordinary files and 755 {{{drwxr-x-r-x}}} for directories or CGI scripts. You may also need to check extended permissions (such as SELinux permissions) on operating systems that support them.
  
  === An Example ===
- 
  Lets say that you received the {{{Permission Denied}}} error when accessing the file {{{/usr/local/apache2/htdocs/foo/bar.html}}} on a unix-like system.
  
  First check the existing permissions on the file:
+ 
+ {{{
- {{{ cd /usr/local/apache2/htdocs/foo
+ cd /usr/local/apache2/htdocs/foo
- ls -l bar.html
+ ls -l bar.htm
  }}}
+ Fix them if necessary:
  
- Fix them if necessary:
- {{{ 
+ {{{
- chmod 644 bar.html }}}
+ chmod 644 bar.html
+ }}}
+ Then do the same for the directory and each parent directory ({{{/usr/local/apache2/htdocs/foo}}}, {{{/usr/local/apache2/htdocs}}}, {{{/usr/local/apache2}}}, {{{/usr/local}}}, {{{/usr}}}):
  
- Then do the same for the directory and each parent directory ({{{/usr/local/apache2/htdocs/foo}}}, {{{/usr/local/apache2/htdocs}}}, {{{/usr/local/apache2}}}, {{{/usr/local}}}, {{{/usr}}}):
  {{{
  ls -la
  chmod +x .
  cd ..
  # repeat up to the root
  }}}
+ On some systems, the utility {{{namei}}} can be used to help find permissions problems by listing the permissions along each component of the path:
  
- On some systems, the utility {{{namei}}} can be used to help find permissions problems by listing the permissions along each component of the path:
  {{{
  namei -m /usr/local/apache2/htdocs/foo/bar.html
  }}}
- 
  If all the standard permissions are correct and you still get a {{{Permission Denied}}} error, you should check for extended-permissions. For example you can use the command {{{setenforce 0}}} to turn off SELinux and check to see if the problem goes away. If so, {{{ls -alZ}}} can be used to view SELinux permission and {{{chcon}}} to fix them.
  
  '''DO NOT''' set files or directories to mode 777, even "just to test", even if "it's just a test server". The purpose of a test server is to get things right in a safe environment, not to get away with doing it wrong.