Enhance your Career in Networking With IPinBits!!!​

Linux for network engineers – file permissions

Taking further our Linux for network engineers, today we will study about the FILE PERMISSIONS  in linux. But why do need it? – Because linux is a multi-user operating system which can be accessed by many users simultaneously. So who access what is a security concern which should be addressed. It is same as privileges provided to user at enable/conf terminal in cisco ios.

For effective security, Linux divides authorization into two levels:-
1. Ownership – See this article -> Linux ownership
2. Permission

In this article we will study about the linux file permissions. How do we view permissions :-

Here we have TEN characters – drwxrwxrwx. Below is the explaination

File type can be as follows :-

First Character File Type
Normal file
d Directory
l Symbolic link
p Named pipe
b Blocked device
c Character device
s Socket

The next nine charters are for permissions :-

permission on a file on a directory
r (read) read file content (cat) read directory content (ls)
w (write) change file content (vi) create file in directory (touch)
x (execute) execute the file enter the directory (cd)

So once we understand type and permissions of a file. We can use “chmod” to alter the permissions.

chmod permissions filename

There are 2 ways to use the command –

  1. Absolute mode
  2. Symbolic mode

In Absolute mode, file permissions are not represented as characters but a three-digit octal number. The table below gives numbers for all for permissions types.

Number Permission Type Symbol
0 No Permission
1 Execute –x
2 Write -w-
3 Execute + Write -wx
4 Read r–
5 Read + Execute r-x
6 Read +Write rw-
7 Read + Write +Execute rwx

Let’s see absolute mode in action :- We changed the articles file permission to only read/write for user only.

In the Absolute mode, you change permissions for all 3 owners. In the symbolic mode, you can modify permissions of a specific owner. It makes use of mathematical symbols to modify the Unix file permissions.

Operator Description
+ Adds a permission to a file or directory
Removes the permission
= Sets the permission and overrides the permissions set earlier.

The various owners are represented as –

User Denotations
u user/owner
g group
o other
a all

Let’s add the read and execute permissions to all users :-

So this was all about the linux file permission. I know, its confusing so please do the following homework on your linux machine.

HOME WORK

Related blog posts