Permissions identify who can do what to the file or directory. The options are read, write, and execute. These options can be set differently for three unique types of users: the owner of the file; members of a particular group, which a server administrator sets; and, others. There is also the implied everyone level, which includes all of the previously mentioned users.
Normally by default, a file's owner is given read and write permissions, whereas groups and others are able to read a file or directory. Execute has a value 1, write 2 and read 4.
Here are some file permission modes:
| Permission | Description |
|---|---|
| 777 | Owner, group, and others have read, write, or execute (-rwxrwxrwx) |
| 755 | Owner has read, write, and execute; group, and others have only read and execute (-rwxr-xr-x) |
| 711 | Owner has read, write, and execute; group, and others have only execute (-rwx--x--x) |
| 700 | Owner has read, write, and execute; group, and group, and others have nothing (-rwx------) |
| 644 | Owner has read and write, others have only read (-rw-r--r--) |
| 666 | Owner, group and others have read and write (-rw-rw-rw-) |
PHP has built-in functions.
| Function | Description |
|---|---|
| chown(filename, newuser) | Changes the ownership of a file |
| chgrp(filename, newgroup) | Changes group membership |
| chmod(filename, octal_mode) | Chnages file permisions |