File Permissions and Access Control Lists

#Day6 #DevOps #90daysofDevops #trainwithshubham #AWS #linuxcommands #linuxshellscripting #userpermissions

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

vim devops.txt #to create a file named devops.txt
ls -ltr #to view the details of the file
-rw-rw-r-- #read and write permission to user and group , and read only 
#permission to others only.

Each of the three permissions is 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 user's permissions of a file or directory.

    As a task, change the user permissions of the file and note the changes after ls -ltr

chmod 666 devops.txt #to change the user permission 
-rw-rw-rw- #read and write permission to all

Task 2:Write an article about File Permissions.

In Linux, file permissions are an essential aspect of the operating system's security model. They determine who can access a file, what actions they can perform on it, and who else can interact with the file. Linux uses a three-level permission system, indicating access rights for three user groups: the owner of the file, the group associated with the file, and all other users.

The three basic permissions:

  1. r (Read): Allows reading the contents of a file or viewing the contents of a directory.

  2. w (Write): Allows modifying the content of a file or creating/deleting files within a directory.

  3. x (Execute): Allows the execution of a file (for programs/scripts) or accessing a directory (to navigate into it).

File permissions can be displayed using the ls -l command in the terminal, which will show a long listing of files and directories with their corresponding permissions.

  • 4: Read permission

  • 2: Write permission

  • 1: Execute permission

Remember that modifying file permissions should be done with caution, as improper settings can lead to security vulnerabilities or unexpected behavior. Always ensure that you have appropriate permissions to modify file permissions, especially for system files.

Task 3:What is ACL and try out the commands getfacl and setfacl

ACL stands for Access Control List, and it is an extension of the traditional Linux file permissions system. ACLs provide a more flexible and fine-grained way to control access to files and directories. While the standard file permissions (owner, group, and others) provide basic access control, ACLs allow you to define specific permissions for individual users and groups beyond the standard three-level system.

The basic commands for managing ACLs in Linux are getfacl and setfacl.

getfacl: This command is used to view the ACLs associated with a file or directory.

setfacl: This command is used to set or modify the ACL for a file or directory.

ACLs can be powerful tools for managing file permissions in Linux, but they should be used with care and understanding, as they can increase complexity if not managed properly.

Thank you for reading :)

Priyanka varshney

###

0
Subscribe to my newsletter

Read articles from priyanka varshney directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

priyanka varshney
priyanka varshney

๐Ÿ‘‹ Hello, and welcome to my DevOps journey! ๐Ÿš€ I am Priyanka Varshney,๐Ÿ› ๏ธ As an aspiring DevOps engineer, I'm all about bridging the gap between development and operations, making software delivery seamless and efficient. ๐Ÿ’ป๐Ÿ”ง On this Hashnode blog, I'll be sharing my learnings, experiences and adventures as I dive deep into the world of continuous integration, automation, and cloud technologies. โ˜๏ธโš™๏ธ Let's connect, learn, and grow as a vibrant DevOps community. Follow my Hashnode blog, and let's embrace the DevOps adventure together! ๐Ÿค๐Ÿ”—