SIVA 99

File Permissions in Linux

Linux is a multi-user system where the same resources can be shared by different users.
All permissions in Linux are based on restricting access to specific files and folders to specific users or user groups.

Types of Files

In Linux, total 7 files types are there.
- --> normal file
d --> directory file
l --> link file
b --> block special file
p --> block special file
c --> character special file
s --> socket file

Types of permissions

In Linux, File and Directories have three basic permissions types.

Read Permission (r) :

The Read Permission allows you to open and read the content of a file. But you can't do anything.

Write Permission (r) :

The Write Permission allows you to emodify the file and write new data to the file.

Execute Permission (x) :

The execute permission allows the user to execute the file as a shell script or a program.

Types of permissions

In Linux, File and Directories are owned by a specific user and group and are defined separately as three user based permission groups. They are as follows:

From above image :
-rw-rw-r-- this statement we are divide into 4 parts
- --> file type
rw- --> user level permissions
rw- --> group level permissions
rw- --> others permissions

The numbers are a binary representation of the rwx string.

Changing file permission using chmod

if we observe first file3(file name) has 664 permissions are there.. right now, 777 permissions.

Changing Ownership

Change Ownership of the file :

Change Ownership of the group :

Change Ownership of the directory :

Change Ownership of the directory along with inside files :

Liked This Article?

Conclusion

Linux as a multi-operating system sets permissions and ownership to ensure security for a file and directories of the users. And it also allows to change and modify the permissions to a set of people as per the requirements.

Leave a Reply

Your email address will not be published. Required fields are marked *