www.linux-noob.com: set correct permissions on your apache files - www.linux-noob.com

Jump to content

Page 1 of 1

set correct permissions on your apache files and directories

#1 User is offline   anyweb

  • Administrator
  • PipPipPipPipPipPipPipPip
  • Group: Admin
  • Posts: 3,265
  • Joined: 11-December 03

Posted 14 December 2004 - 04:32 PM

the easy way

as root cd to the 'document root path' of your apache server and do as follows

find . -type f -exec chmod 644 {} \; && find . -type d -exec chmod 755 {} \;


this sets all your files to 644 and all your directories to 755

for example,

cd /usr/local/apache/website/mystuff

find . -type f -exec chmod 644 {} \; && find . -type d -exec chmod 755 {} \;


cheers

anyweb

This post has been edited by anyweb: 17 April 2005 - 12:02 AM

My linkedin profile at > linkedin.com
My personal website is > niallbrady.com
0

#2 User is offline   tinhnho

  • Noob
  • Pip
  • Group: Members
  • Posts: 3
  • Joined: 16-April 05

Posted 16 April 2005 - 08:49 PM

i used this command to chmod apache folder, but somehow my forums has error

hi everyone

my forums have this proplem:


Quote

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

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@mysite.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

--------------------------------------------------------------------------------
i try to restart apache, but it tells me that server error

Quote

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

root@myhost [/usr/local]# service httpd restart
/etc/init.d/httpd restart: configuration broken, ignoring restart
/etc/init.d/httpd restart: (run 'apachectl configtest' for details)

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



then i run config for detail:

Quote

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

root@myhost [/usr/local]# /etc/init.d/httpd configtest
/etc/init.d/httpd: line 175: /usr/local/apache/bin/httpd: Permission denied

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



Any idea? thanks

p/s: I think the apache folder has proplem with chmod, what should i do to make it go back normal ? Other website html...etc. just work fine, but only forums has the proplem
0

#3 User is offline   znx

  • Linux-Noob GURU
  • PipPipPipPipPipPipPipPip
  • View blog
  • Group: Members
  • Posts: 1,236
  • Joined: 21-March 05

Posted 16 April 2005 - 11:50 PM

tinhnho, on Apr 16 2005, 08:49 PM, said:

i used this command to chmod apache folder, but somehow my forums has error


most forums use caches that require the ability for the server to write to the directories. the permissions from above that anyweb quoted will not give them to it.

unfortunately without more information about the type of forum i can't really tell you the permissions you'll need to set.

tinhnho, on Apr 16 2005, 08:49 PM, said:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@mysite.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.


OK so that looks like the server dislikes something.. not the forum. maybe this is related to the htaccess / server config files ? also it points out the fact that the error document doesn't exist

tinhnho, on Apr 16 2005, 08:49 PM, said:

root@myhost [/usr/local]# service httpd restart
/etc/init.d/httpd restart: configuration broken, ignoring restart
/etc/init.d/httpd restart: (run 'apachectl configtest' for details)
root@myhost [/usr/local]# /etc/init.d/httpd configtest
/etc/init.d/httpd: line 175: /usr/local/apache/bin/httpd: Permission denied


OK again something more has happened to your system. the permissions alterations that anyweb suggested would not this...

OH wait.. i see it... OK i know what the problem is now I think.

did you run the command that anyweb suggested from /usr/local, if so this is the problem. i think you have stripped the executable permissions from your server.

try:
# chmod 755 /usr/local/apache/bin/*


tinhnho, on Apr 16 2005, 08:49 PM, said:

p/s: I think the apache folder has proplem with chmod, what should i do to make it go back normal ? Other website html...etc. just work fine, but only forums has the proplem


yeah... the difficulty here is understand what anyweb meant when he said:

anyweb, on Dec 14 2004, 04:32 PM, said:

as root cd to the 'path' of your apache server and do as follows


What he meant was cd into the document root for your web server. this is defined inside the configuration file for apache. a quick:

# grep -i documentroot apache2.conf
DocumentRoot /var/www/localhost/htdocs


So you would need to cd into that directory before committing anyweb's commands.

if you are running a forum however certain extra permissions maybe required on certain directories to allow the server to write to that directory/file, most of the installation documentation will indicate this for you.
0

Page 1 of 1

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users





The G2-style Tux and the header images using them are licensed under Creative Commons BY-NC-SA. The G2-style Tux images are all from http://crystalxp.net.
Thanks to users kami23, lilitux, iva, overlord59, whidou, brightknight, emulienfou on the Crystal XP Tux Factory site.