WackoWiki: Setting File Permissions

https://wackowiki.org/doc     Version: 56 (06.07.2023 11:06)

Setting File Permissions

Also available in Deutsch[link1], Español[link2], Français, Русский[link3], 简体中文[link4].

1. Unix permissions

All the files and folders permissions[link5] are set according to current web server configuration.

There could be some different situations when the webserver runs:
  1. owner - with the same username as file/directory owner
  2. group - with the same group name as file/directory owner/user group
  3. others - as nobody
  4. as root

Permissions Directory File Notes
1. owner
0500 0400
0700 0600
2. group
0550 0440
0770 0660
3. others
0555 0444

2. Package / Repository

The default permission are:

Permissions Directory File
default 0755 0644

3. Installation / Upgrade

Change the permissions on the following directories and files to be writable

3.1. Directories

chmod 0755 _cache/config/ _cache/feed/ _cache/page/ _cache/query/ _cache/session/ _cache/template/ file/backup/ file/global/ file/perpage/ file/thumb/ file/thumb_local/ xml/

3.2. Files

chmod 0660 config/lock config/lock_ap

reset after installation / upgrade
chmod 640 config/config.php

3.3. Defaults

const CHMOD_SAFE	= 0640;			// better to use 0600 in production
const CHMOD_FILE	= 0644;			// file creation mode
const CHMOD_DIR		= 0755;			// directory creation mode	

4. Production / Server

Ensure that you've set the permissions as restrictive as possible -- let config files be only readable for owner and webserver and nobody else.

Files require chmod 400 if the webserver runs as file owner username or 440 if the webserver runs as file owner usergroup:

5. How to set up File Permissions

In most cases on hosting servers webserver runs as file owner username so the required chmod values are 644 for files and 755 for folders to make them readable and writable for both owner and webserver, and readable for group and others.

To make all files chmod 644 run in SSH console:

find /your_site_public_html -type f -exec chmod 644 {} \;	

To make all directories chmod 755 run in SSH console::

find /your_site_public_html -type d -exec chmod 755 {} \;	

6. Changing ownership


 id -gn	

ls -ld /home/user/workspace/wackowiki/	

sudo chown -R user:group /home/user/workspace/wackowiki/