Understanding File or Folder Permissions in Linux
In Linux nothing is taken for granted. Linux is secure and it will always continue to be. What are file/folder permissions in Linux?
It becomes very boring when you can’t even open, delete or modify your own files and folders on Linux as a beginner. When I started using Ubuntu and doesn’t know about file/folder permissions I only allow these stubborn secured files and folders to just have their way on my computer.
Most people have gone through this before, where files and folders become immutable to them due to file permissions. Is file or folder permission setting necessary at all? YES. Want to know why, continue reading.
Today am going to show what file and folder permissions is all about.
Let’s get started.
The command that will help us solve this is known as chmod.
chmod command is used to set the permission of a file or folder. chmod command uses three digits as a parameter to assign permissions to files or folders. chmod changes the file mode bits of each given file according to mode, which can be either a symbolic representation of changes to make, or an octal number representing the bit pattern for the new mode bits.
$ sudo chmod XXX file/folder name
Understanding the example above,
The XXX in the command are the digits used in manipulating of bits to change permissions.
The first X represents the Owner (current user)
The second X represents Group (set by owner)
The third X represents anyone else
Here we dealing with 3-bits xxx where one of the 3-bits is set to 1 it means you are permitted to do something, when set to 0 you are not.
for these bits xxx, they stand for x-Read, x- Write and x-Execute (in their respective order).
The list below shows the Decimals, Bits and Meanings
0 = 000 = No permission, this person can neither read, write nor execute
1 = 001 = Execute only (because last bit set to 1)
2 = 010 = Write only (because middle bit set to 1)
3 = 011 = Write and Execute only (because last 2 bits set to 1)
4 = 100 = Read only (because first bit set to 1)
5 = 101 = Read and Execute only (because first and last bits set to 1)
6 = 110 = Read and Write only (because first and second bits set to 1)
7 = 111 = Read, Write and Execute (because all bits set to 1)
Now let’s try our hands on a real file. Using ls -l to list files and folders in a directory displays the permission of files with
- r (Read)
- w (Write)
- x (Execute)
The first, second and third part corresponds Owner, Group and anyone permissions.
Looking at the codes below, only the Owner have permission to the file.
enock@enock-pc:~/unixmen$ ls -l total 0 -rwx------ 1 enock enock 0 Aug 25 18:05 unixmen.txt
Looking at the codes below, only the owner and anyone have permission to the file.
enock@enock-pc:~/unixmen$ chmod 707 unixmen.txt enock@enock-pc:~/unixmen$ ls -l total 0 -rwx---rwx 1 enock enock 0 Aug 25 18:05 unixmen.txt
Looking at the codes below, everybody have permissions to the file.
enock@enock-pc:~/unixmen$ chmod 777 unixmen.txt enock@enock-pc:~/unixmen$ ls -l total 0 -rwxrwxrwx 1 enock enock 0 Aug 25 18:05 unixmen.txt
Now you can change the permission of files or folders.
NOTE: It is not good to set permission of confidential files or folders to 777.
Like us on Facebook
This week Top Posts
- Top Things To Do After Installing Ubuntu 13.10 'Saucy Salamander' : Ubuntu 13.10 Saucy Salamander will be released on coming October 17th with many new salient featur...0 comments |
- Manage Databases And Hosted Servers Remotely With DbNinja : Database administration via command line is bit difficult for newbie system and database administrat...0 comments |
- Setup IT And Asset Management System With GLPI On Debian/Ubuntu : GLPI is the Information Resource-Manager with an additional Administration Interface. You can use it...0 comments |
- How To Configure Linux Clients To Authenticate Using OpenLDAP : This is the continuation of our previous tutorial. In our previous tutorial we learned how to instal...0 comments |
- Install FrostWire 5.6.9 In Elementary OS 'Luna'/ Ubuntu / Linux Mint : FrostWire is a peer-to-peer file sharing program for the gnutella and BitTorrent protocols. FrostWir...0 comments |
- How To Upgrade From Ubuntu 13.04 Raring To Ubuntu 13.10 Saucy Salamander : Ubuntu 13.10 Saucy will be released on October 17th. Hope it will come with lot of improvements and ...0 comments |
- How To Install Linux Kernel 3.12.4 In Ubuntu
- Firefox 26 Has Been Released, How To Install It In Ubuntu And Its Derivates
- How To Install Brasero In Elementary OS ‘Luna’
- Install Sayonara Player In Elementary OS / Ubuntu / Linux Mint
- Manage Databases And Hosted Servers Remotely With DbNinja
- Install FrostWire 5.6.9 In Elementary OS ‘Luna’/ Ubuntu / Linux Mint
- Setup IT And Asset Management System With GLPI On Debian/Ubuntu
- How To Configure Linux Clients To Authenticate Using OpenLDAP
- How To Install Netflix In Ubuntu
- cowsay And fortune Combined Together
This work by unixmen.com is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
Copyright © 2008-2013 Unixmen.com .