|
|||||||||||||
| Home Demo Features Buy Noah Downloads Support Blog FAQ | |||||||||||||
|
Noah's Documentation
Table of Contents
Setting up file permissionsNoah's Classifieds must store the uploaded pictures and media files, writes error log and caches the RSS feed. To be able to do this, Noah's needs sufficient permissions to write these files. At the same time, leaving the permissions too loose can introduce security risks. Noah's Classifieds is executed by PHP, so the PHP process needs to be able to write to these files. The PHP process usually runs with the permissions of the webserver, so the webserver needs to be able to write to these files. The following permissions must be modified for the respective Noah's Classifieds functions to work:
As admin, you can check the necessary file permissions any time by clicking on the
During the installation, the install script attempts to create a file called Note that if you want to use the automatic update feature of Noah's to always have the latest available release installed, you must set much looser permissions! This is because the automatic update runs from the web browser (thus with the permissions of the webserwer) and must be able to write practically any files under the installation directory. For more details, see the update instructions! Windows (using Microsoft IIS)
To make the necessary files and directories writable you need to give “Write” access to the
Internet Guest Account ( A good description with screenshots is available here. UnixThis will apply if you install Noah's Classifieds on a Linux, MacOS X or other Unixoid system. It is most probably also true for rented web space. Note: under Linux additional file system ACLs (FACL) may apply, confer the commands “getfacl” and “setfacl” – file permissions as described below may be meaningless if there are no rights according to FACLs. File Permissions, a short reminderThis is not the place to explain the UNIX file permission system in detail. See Wikipedia for this. Here is just a short refresher:
To find the user and group your PHP process (web server) run under you could try to run the following PHP script: <?php if(function_exists('posix_geteuid')){ // use posix to get current uid and gid $uid = posix_geteuid(); $usr = posix_getpwuid($uid); $user = $usr['name']; $gid = posix_getegid(); $grp = posix_getgrgid($gid); $group = $grp['name']; }else{ // try to create a file and read it's ids $tmp = tempnam ('/tmp', 'check'); $uid = fileowner($tmp); $gid = filegroup($tmp); // try to run ls on it $out = `ls -l $tmp`; $lst = explode(' ',$out); $user = $lst[2]; $group = $lst[3]; unlink($tmp); } echo "Your PHP process seems to run with the UID $uid ($user) and the GID $gid ($group)\n"; ?> Alternatively, you can use short script with phpinfo(), see section User/Group in output: <?php phpinfo(); ?> Common PermissionsHere are the most commonly used values for setting permissions on directories and files.
Which permissions to set?So, how should you set the permissions of the directories mentioned above? In general you should try to set the permissions as restrictive as possible, but there is no general rule which permissions you need to set for your system. On a Linux server with a conventional configuration, however, executing the following commands will do the job:
find -type f -exec chmod 644 {} \;
find -type d -exec chmod 711 {} \;
find pictures upload logs feedcreator -type f -exec chmod 666 {} \;
find pictures upload logs feedcreator -type d -exec chmod 777 {} \;
chmod 755 lang themes gorum/captcha/fonts
find themes -name css -type d -exec chmod 755 {} \;
If you have root (super user rights) you can change the owner of files and directories. This means you can change the owner of the Noah's Classifieds files to the web server user (eg.
If you are a normal user you may be a member of the web server group and can change the files to be owned by this group. Then set the files and directories to be writable by this group. Eg.
If you are alone on the server or running in a completely trusted environment you can simply change the permissions to give everyone access. Eg. If you're running on a shared web server it is recommended to contact your web server administrator or hosting support and ask for help and recommendations. Point them to this page and they should know what you need to do. How to set permissions?On the command line use chmod for changing permissions, chown for changing the owner of files and dirs and chgrp for changing the group. (Note that chown and chgrp may not be available or function as expected if you use a shared web hosting provider.) When accessing your server through FTP, consult the manual of your FTP tool. Most graphical FTP tools have a dialog to set permissions (often to be found in the right-click context menu). On some UN*X-like systems, you may be able to use filesystem ACLs to allow the PHP user to write to the files as well. For Sun's ZFS, see the Solaris ZFS Administrator's guide for details. For POSIX-draft compliant filesystems, like Linux ext2/3 or Sun's UFS on Solaris 8 or later, see the man pages for setfacl and getfacl. Check with your system administrator – some backup systems will ignore ACLs on files. If available, ACLs are more secure than adding the PHP user to your group, giving away the files to the PHP user, or making the files world-writable. |
|||||||||||||