What is chmod?
Chmod is a command that changes the access permissions of files or directories in order to read, write or execute files
How do I view The permissions of files?
You can do this by typing
ls -la
Heres is a example of its output
root@duffys-place:/etc/lighttpd# ls -la total 20 drwxr-xr-x 4 root root 4096 2009-03-29 00:36 . drwxr-xr-x 79 root root 4096 2009-04-05 01:14 .. drwxr-xr-x 2 root root 4096 2009-03-29 00:30 conf-available drwxr-xr-x 2 root root 4096 2008-09-27 11:24 conf-enabled -rw-r--r-- 1 root root 3248 2009-04-05 01:18 lighttpd.conf root@duffys-place:/etc/lighttpd#
What do the letters mean in front of the files/directories mean?
r indicates that it is readable (someone can view the file’s contents)
w indicates that it is writable (someone can edit the file’s contents)
x indicates that it is executable (someone can run the file, if executable)
- indicates that no permission to manipulate has been assigned.
When you are listing files/directories the first character lets you know whether you’re looking at a file or a directory. The next three characters define your permissions.
Using Chmod
7 Full Permissions
5 Read and Execute
4 Read Only
3 Write and Execute
2 Write Only
1 Execute Only
0 No Permissions
Example:
chmod 755 filename
Why is there three numbers?
The First number defines what the owners permissions are.
The second number defines what the group rights are.
And the last number defines what access other users have.
In this case we have 755 so that means the owner has full permissions, group rights to execute and read, and all others access to execute the file.


Sun, Apr 5, 2009
Linux