Linux permission is unique and interesting. To change Linux permission for a file or a folder, user needs to understand the basic concept of the permission. Linux has two basic permission types; file ownership and file permission. Let's see with an example:
luzar@ubuntu:~$ ls -l /root/
total 4
drwxr-xr-x 2 luzar luzar 4096 2011-05-20 06:05 folder
luzar@ubuntu:~$
From the example, we can see that the folder (blue) has ownership (green) and permission (red) highlighted. First let's look at the ownership. Linux has two ownerships, Owner and Group. As we can see from the example, the folder's owner is luzar and the folder's group is also luzar.
As you can see in the example, the Linux permission contains several characters. It looks complicated, but actually it's not. The basic is simple:
[d] [rwx] [r-x] [r-x]
The Linux permission basically is a combination of three permission types for three different groups.
[d] - Indicates folder, files, link, special file, socket, named pipe
[rwx] - Owner
[r-x] - Group
[r-x] - Others/world
Permission types:
r = read permission. View the file or folder.
w = write permission. Create or edit file.
x = execute permission. Run file.
- = no permission.
That's all. So the permission folder above means the owner which is root can view, edit and execute, while the group and others can only read and execute the folder.
Wait, how do we change the permission?
There are two ways we can use to change Linux permissions on folder.
Way number one is the octal system:
1 - Execute (x)
2 - Write (w)
4 - Read (r)
Way number two is using code system:
u - user/owner
g - group
o - others