Day 6 -Linux File Permission and Access Control List

Day 6 -Linux File Permission and Access Control List

The most important factor for every organization is security. Linux is widely known for its security factor.

Linux ensures security and control over sensitive data (files ) & directories. Linux allows administrators to manage the access for users and groups.

To understand file permission we will create a simple file

  • touch test.txt - Create a file with the touch command

  • ls -ltr to see the details of the files

Two important mechanisms that Linux provides are:

  • File permission

  • Access control list

    Linux File Ownership

Users: the user is the owner of the file and the application

  • "chown" is used to change the ownership permission of a file or directory.

Group: Groups that own the file and applications.

  • "chgrp" is used to change the group permission of a file or directory.

Other: All users with access to the system.

others — All users with access to the system. (outside the users are in a group)

There are three kinds of file permissions in Linux:

  • Read (r): Allows a user or group to view a file.

  • Write (w): Permits the user to write or modify a file or directory.

  • Execute (x): A user or group with execute permissions can execute a file or view a directory.

Permission numbers are:

  • 0 = ---

  • 1 = --x

  • 2 = -w-

  • 3 = -wx

  • 4 = r-

  • 5 = r-x

  • 6 = rw-

  • 7 = rwx

For example:

  • chmod 777 folder name will give read, write, and execute permissions for everyone.

  • chmod 700 folder name will give read, write, and execute permissions for the user only.

Task :

change the user permissions of the file and note the changes after ls -ltr

The above task changed the file permission to execute.

Access Control List

ACL is a service that is used for providing special permission to specific Users & Groups for particular files and directories. ACLs can set read, write, and execute permissions for the owner, group, and other users.

getfacl - To check the Access Control permission.

setfacl - command is used to set ACL permission.

In the Above task set ACL permission to the user.

Thank you for reading this blog.

Happy Learning!