File permission in Linux

File permission in Linux

File permissions on Unix and Linux are one of the most common stumbling blocks for regular users of those operating systems. It’s a complex structure where users in the system are allowed to do what is one of the foundations of Unix, providing security and interoperability, but sometimes it can make working with the system painful. Here’s how permissions work and how they work with them.

2 level

1 . owenership

2. permission

Ownership in linux files

Every file in drectory in your unix and linux system assigned three type of owner

#user

User is owner of this file.via default user also called an owner

#group

User group contain multiple user.all user in the group have the same file permission

#other

Any other user who has access to a file. Does not own the file and does not belong to a user group

Permission system in linux

1 .read = this permission give you authority a read a file

2. write = this permission give you authority to modified a content of a file write permission on your directory give you authority to add remove and rename file and stored in directory.

3.execute = this permission you not set you will not be able run the file

(-) it means no permission

Owner



permission of owner ,the owner(read )or (write) the file but he does execute the file

User group




user group member can read the file and write(edit) the file

r — it means other user only read the file

 

changing file/directory permission

chmod permission filename

We can use #chmod command which stand from “change mode” we can set command set permission that read write and execute owner file /directory for the owner group and the world

How to give permission

R = 4

 

W =2

 

E = 1

 

Total =7

Let check how to give permission

Question .1 give to the user permission only read and write the file and the give to the groupuser only read the file and other user only write (edit) the file

Answer= in this answer change the permission of #myfile

Example $ (chmod 642 myfile* enter)

2. question create a Deepak name directory and all permission have you give to user permission only read and write group user only write and other read and write

Answer = $ (chmod 626 deepak*enter )

Changing ownerhip and group

you can change the owner file/directory

# sudochown user
# sudo chown user:group

Tags:

No responses yet

Leave a Reply

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

Latest Comments

No comments to show.