Day 6 : Cloud and DevOps

Day 6 : Cloud and DevOps

File Permissions and Access Control Lists

⚡File Permissions:

Linux file system determines who can access files and directories on a system and how. This blog gives an overview of Linux file permissions, how they work, and how to change them.

-- To View the permissions -> we use the ls -l command


Article content

Here we see the metadata of files and directories -


  1. The first character shows if it's a file (-) or a directory (d).
  2. The next set of 9 characters (rwx) shows the security.
  3. The next column shows the owner of the file.
  4. The next column shows who is the group owner of the file.
  5. Then the size of the file (bytes) is shown.
  6. The final column shows the filename.


🌟Type of Ownership - 3 types

Article content

-- user (u) - This is applied only to the owner of the file or directory.

-- group (g) - This is applied to the group assigned to the file or directory and does not affect the actions of other users.

-- other users (o) - This is applied to all other users on the system.

🌟Security permissions -

Article content

File permissions -

Read - This permission is used to access the file's content. Read permission is required to make copies of a file because we need to access the file's content to duplicate it.

-- We can use cat or less commands to see the file content.

Wite - Required to modify or change the file content.

Execute - Allows us to execute the content of a file like a bash shell script, python programs, etc.

Directory permissions -

Read - This allows us to read the contents of the directory which means we can view the content (file or dir) stored within the directory. This is required for the ls command.

Write - This allows us to modify the content of the directory.

-- Create or copy files into the directory.

-- Move or remove files from the directory.

Execute - This permission is different on directories if we compare from files. Execute permission provides access to the directory. It not only authorizes you to look at extended information of files in the dir but also allows you to change your working directory or pass through this dir when you are accessing any subdirectory inside.

⚡How to change the security permissions:

We use the chmod command which stands for "change mode".

There are 2 ways of modifying the permissions.


  1. Using octal values - 4, 2, 1 (mentioned in the above image)
  2. Using symbols - r, w, x


Syntax: chmod <permission> <filename>

Ex.

> chmod u+x tasks.sh

> chmod 764 tasks.sh

Both the commands will give -

rwx to the owner (u)

rw- to group (g)

r-- to other users (o)


Article content

Another example -

> chmod ug+rwx tasks.sh

This gives read write and execute permission to the owner and group.



Article content

There can be many combinations and ways to define a set of permissions using symbols and octal values.


To view or add a comment, sign in

More articles by Aditya Thakre

  • Day 8 & 9 : Cloud and DevOps

    ⚡Version Control system: The version control system helps us keep track of our changes by storing all the version…

    1 Comment
  • Day 7 : Cloud and DevOps

    ⚡What is Package Manager in Linux? A package manager is a tool that is used to download, install, update, configure…

  • Day 4 : cloud and DevOps

    What is Shell Scripting for DevOps: Linux kernel does not understand the human language so, the shell helps in…

  • DAY 3 : Cloud and DevOps

    What is a Linux Command: A Linux command is a program or utility that runs on the command line. A command line is an…

  • DAY 2

    Linux: Linux is an open-source operating system that is based on the Unix operating system. It was developed by Linus…

  • DAY 1 of learning DevOps

    Introduction to DevOps: DevOps is not a tool but a methodology to bridge the gap between development and Operations…

Insights from the community

Others also viewed

Explore topics