Day 6 Tasks: 6/90 Days

Day 6 Tasks: 6/90 Days

Day 6 Task: File Permissions and Access Control Lists

Today is more on Reading, Learning and Implementing File permissions

The concept of Linux File permission and ownership is important in Linux. Here, we will be working on Linux permissions and ownership and will do tasks on both of them. Let us start with the Permissions.

  1. Create a simple file and do ls -ltr to see the details of the files

Each of the three permissions are assigned to three defined categories of users. The categories are:

  • owner — The owner of the file or application.
  • "chown" is used to change the ownership permission of a file or directory.
  • group — The group that owns the file or application.
  • "chgrp" is used to change the group permission of a file or directory.
  • others — All users with access to the system. (outised the users are in a group)
  • "chmod" is used to change the other users permissions of a file or directory.As a task, change the user permissions of the file and note the changes after ls -ltr

  1. Write an article about File Permissions based on your understanding from the notes.
  2. Read about ACL and try out the commands getfacl and setfacl

********************************************************************

o change directory permissions in Linux, use the following:

  • chmod +rwx filename to add permissions
  • chmod -rwx directoryname to remove permissions.?
  • chmod +x filename to allow executable permissions.
  • chmod -wx filename to take out write and executable permissions.

Note that “r” is for read, “w” is for write, and “x” is for execute.?

This only changes the permissions for the owner of the file.

********************************************************************

There are three options for permission groups available to you in Linux. These are

  • owners: these permissions will only apply to owners and will not affect other groups.
  • groups: you can assign a group of users specific permissions, which will only impact users within the group.
  • all users: these permissions will apply to all users, and as a result, they present the greatest security risk and should be assigned with caution.

********************************************************************

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 grup with execute permissions can execute a file or view a directory.??********************************************************************

More ways to manage permissions::

Here's a more comprehensive list of ways you can manage file permissions, groups, and ownership beyond the basic commands listed at the top of this guide.?

How to Change Directory Permissions in Linux for the Group Owners and Others::

The command for changing directory permissions for group owners is similar, but add a “g” for group or “o” for users:

  • chmod g+w filename
  • chmod g-wx filename
  • chmod o+w filename
  • chmod o-rwx foldername

To change directory permissions for everyone, use “u” for users, “g” for group, “o” for others, and “ugo” or “a” (for all).

  • chmod ugo+rwx foldername to give read, write, and execute to everyone.
  • chmod a=r foldername to give only read permission for everyone.

********************************************************************

Group Permissions::

By issuing these commands, you can change groups of files and directories in Linux.?

  • chgrp groupname filename
  • chgrp groupname foldername

Note that the group must exit before you can assign groups to files and directories.


********************************************************************

Changing ownership in Linux

Another helpful command is changing ownerships of files and directories in Linux:

  • chown name filename
  • chown name foldername

These commands will give ownership to someone, but all sub files and directories still belong to the original owner.

You can also combine the group and ownership command by using:

  • chown -R name:filename /home/name/directoryname

********************************************************************

Changing Linux permissions in numeric code

You may need to know how to change permissions in numeric code in Linux, so to do this you use numbers instead of “r”, “w”, or “x”.

  • 0 = No Permission
  • 1 = Execute
  • 2 = Write
  • 4 = Read

********************************************************************

Permission numbers are:

  • 0 = ---
  • 1 = --x
  • 2 = -w-
  • 3 = -wx
  • 4 = r-
  • 5 = r-x
  • 6 = rw-
  • 7 = rwx

in short it is combinition of 0 1 2 4 numeric commands

  • chmod 777 foldername will give read, write, and execute permissions for everyone.
  • chmod 700 foldername will give read, write, and execute permissions for the user only.
  • chmod 327 foldername will give write and execute (3) permission for the user, w (2) for the group, and read, write, and execute for the users.

要查看或添加评论,请登录

Pranav Lahitkar的更多文章

  • AWS Networking Concepts

    AWS Networking Concepts

    1. Introduction to AWS Networking AWS provides a range of networking services to help businesses connect, secure, and…

  • Linux User & Group Management Cheat Sheet

    Linux User & Group Management Cheat Sheet

    1. Creating a New User Create a user (without home directory): sudo useradd username Create a user with a home…

  • Revisiting Networking Topics: The Key to Mastering IT Infrastructure

    Revisiting Networking Topics: The Key to Mastering IT Infrastructure

    In today's fast-evolving tech world, staying current with networking topics is crucial for IT professionals, engineers,…

    2 条评论
  • ViM Text Editor

    ViM Text Editor

    vim (Vi IMproved) is a powerful text editor that is widely used on Unix-like systems. Here’s a guide to the most…

  • LINUX BOOT PROCESS

    LINUX BOOT PROCESS

    Have you ever wondered what happens behind the scenes from the time you press the power button until the Linux login…

  • DevOps tools: Jenkins and GitLab CI/CD.

    DevOps tools: Jenkins and GitLab CI/CD.

    Let's compare two popular DevOps tools: Jenkins and GitLab CI/CD. ### Jenkins 1.

    2 条评论
  • TOP 3 Cloud service providers comparison

    TOP 3 Cloud service providers comparison

    Let's compare the top three cloud service providers: Amazon Web Services (AWS), Microsoft Azure, and Google Cloud…

  • Role of Automation in DevOps

    Role of Automation in DevOps

    Introduction DevOps, a cultural and technical movement within organizations, emphasizes collaboration, integration, and…

    2 条评论
  • Myths About DevOps as a Career

    Myths About DevOps as a Career

    Introduction Title: Understanding DevOps: Myths and Realities Introduction: Brief overview of DevOps and its…

    1 条评论
  • Title: Ensuring Cloud Security: Best Practices and Steps to Achieve Them

    Title: Ensuring Cloud Security: Best Practices and Steps to Achieve Them

    First of all here are some basic terminologies in cloud security: Here are explanations of some important terminologies…

    3 条评论

社区洞察

其他会员也浏览了