Using chmod

From Online Manual

(Redirected from What is chmod)
Jump to: navigation, search
chmod (short for change mode) is a command for changing permissions on files and directories. These permissions determine whether your forum's readers can see your site, and whether the SMF package manager can patch or replace a file.

SMF will work well with settings of 755 for directories and 644 for files -- on most webservers. If you have questions, check with your host for more information about how your webserver is set up. Some webhosts allow permissions of 777 on directories and 666 on files. On other hosts, these settings will cause 500 errors when anyone tries to look at your SMF website.

Chmod file permission settings comes with three digits (644, for example), which represent permissions for the owner, group, and world. These settings control what programs running on your website's computer can do with the files, depending on what user that program is "logged in" as. If the webserver runs your website as though it were logged in as you, only the owner permissions (first digit) matter. If it runs as "nobody", then only the world permissions (third digit) matter.

When you use SMF to modification package, SMF needs to edit some files, replace others, add files to existing directories, and even create new directories full of files. To do this, it needs the permissions to be set high enough to allow this. This is why the SMF package manager comes with a File Permissions tool. When you use the file permissions tool, you will be setting chmod file permissions. Depending on how your host is set up, SMF may need to use your FTP login to complete this task. Alternatively, you can log in using FTP and do this yourself, or (if your host allows it) you can use telnet or SSH to log in and use the chmod command.

Since CHMOD depends on who owns the files and who is trying to use them, file ownership is important. If you run into problems where you are sure you have corred CHMOD permissions, but SMF does not seem to have permission to do something (like install a mod), then find out who owns the files. If you are confused about file ownership and what user the webserver runs as on your site, talk to your host. In some cases, you will need to CHOWN (change ownership) the file ownership settings for a file, and you may need your host's help for that.

Using chmod on the unix command line

Syntax: chmod mode file
Example: chmod 766 readme.txt

chmod codes

Each digit in the mode parameter represents the permissions for a user or a class of users:

  • the first digit corresponds to the owner of the file
  • the second digit corresponds to the file's group
  • the final digit corresponds to everybody else.


There are eight digits that can be used in the mode parameter.

  • 0 - Deny all
  • 1 - Execute Only
  • 2 - Write Only
  • 3 - Execute + Write
  • 4 - Read Only
  • 5 - Read + Execute
  • 6 - Read + Write
  • 7 - Read + Write + Execute

Examples: You set your directory permissions to 755. This means that the directory owner can read, write, and execute, while group and world can read and execute (use) the directory.
You set your file permissions to 644. This means that the file owner can read and write (edit) the file, while everyone else can only read it.

SMF files that must be writeable by the webserver

  • /attachments
  • /cache