Tealmermaid Designs

web design, coding, and SEO tips and tricks

Codes for CHMOD


chmod codes

CHMOD is an abbreviation of change mode. This is a UNIX command to change the permissions on a file. It is based on the Binary language. When viewed on a server, file permissions appear in the form:

aaabbbccc user filename

where a represents the permissions granted to the owner of the file, b represents the permissions granted to the usergroup of the file, and c represents the permissions granted to everyone else.

File permissions

There are four states for each permission:

  • 0: "no permission to access", shown as -
  • 4: "read permission", shown as r
  • 6: "write permission", shown as w
  • 7: "execute permission", shown as x
  • These file permissions can be changed with CHMOD. This can be done at the command line in the form:

    chmod abc filename

    Common file permissions:

  • 755 (for cgi scripts)
  • 666 (for data files)
  • 644 (for configuration files which are not updated by a script)
  • 755 (for directories)
  • A typical HTML, PHP, or image file on a server should have its permissions set to 644 (shown on the server as -rw-r--r--. It is rare to need them to have any other permissions -- and if you do see another permission displayed, it may be that your file has been hacked.

    As a rule, do not ever set any file to have permissions reading 777. This grants read, write, and execute permission to anyone who can access the file. It is just begging someone to hack your server.