We have learned how Ubuntu permissions work in the Linux file permissions guide. Here is a guide on how to change Ubuntu permissions on folder.
Examples of Ubuntu change permissions on folder:
Ubuntu current permissions on folder:
luzar@ubuntu:~$ ls -l
total 4
drwxr-xr-x 2 luzar luzar 4096 2011-05-20 12:38 folder
luzar@ubuntu:~$
The Ubuntu command we are going to use is chmod. The chmod command is used to change file mode bits. So now we are going to practice the Ubuntu change permissions on folder with some examples:
Example 1 - Change group permissions on folder to execute only and others to read and execute.
The Octal method:
luzar@ubuntu:~$ chmod 715 folder
luzar@ubuntu:~$ ls -l
total 4
drwx--xr-x 2 luzar luzar 4096 2011-05-20 12:38 folder
luzar@ubuntu:~$
The code method:
(Based on Ubuntu current permissions on folder)
luzar@ubuntu:~$ chmod g-r folder
luzar@ubuntu:~$ ls -l
total 4
drwx--xr-x 2 luzar luzar 4096 2011-05-20 12:38 folder
luzar@ubuntu:~$
Example 2 - Change others permissions on folder to read only and group to read, write and execute.
The Octal method:
luzar@ubuntu:~$ chmod 774 folder
luzar@ubuntu:~$ ls -l
total 4
drwxrwxr-- 2 luzar luzar 4096 2011-05-20 12:38 folder
luzar@ubuntu:~$
The code method:
(Based on Ubuntu permissions in example 1)
luzar@ubuntu:~$ chmod g+rw folder/
luzar@ubuntu:~$ chmod o-x folder/
luzar@ubuntu:~$ ls -l
total 4
drwxrwxr-- 2 luzar luzar 4096 2011-05-20 12:38 folder
luzar@ubuntu:~$
Example 3 - Give no permissions on folder for group and others.
The Octal method:
luzar@ubuntu:~$ chmod 700 folder
luzar@ubuntu:~$ ls -l
total 4
drwx------ 2 luzar luzar 4096 2011-05-20 12:38 folder
luzar@ubuntu:~$
The code method:
(Based on Ubuntu permissions in example 2)
luzar@ubuntu:~$ chmod go-rwx folder/
luzar@ubuntu:~$ ls -l
total 4
drwx------ 2 luzar luzar 4096 2011-05-20 12:38 folder
luzar@ubuntu:~$
*Note: Using the code method, the command depends on the current permissions. List the current permissions with ls -l command so you can decide to add (+) or remove (-) certain permission.
That's all. Permissions on Ubuntu is not so complicated. You just need some times to get used to it. My advice is, just use one way of changing the Ubuntu permissions. Choose the one which suit you, either the octal method or the code method.