Day 6 Task: File Permissions and Access Control Lists
Task1 : Create a simple file and do ls -ltr to see the details of the files refer to Notes
To complete the task, we'll follow these steps:
Create a simple file named
file.txt
.Use
ls -ltr
to view the details of the file, including its permissions.Use
chown
to change the ownership of the file.Use
chgrp
to change the group ownership of the file.Use
chmod
to change the permissions for others.View the updated details of the file using
ls -ltr
.
Let's go through each step:
Create the file:
View file details:
This will display the details of the file, including its permissions, owner, group, and other information.
- Change the ownership:
- Change the group ownership:
- Change the permissions for others:
This command grants read, write, and execute permissions to others. You can adjust the permissions as needed.
View the updated file details:
This will display the updated details of the file, including the changes made to ownership and permissions.
By following these steps, you can create a file, modify its ownership and permissions, and view the changes using the ls -ltr
command. Adjust the commands according to your specific requirements and preferences.
Task2 : Write an article about File Permissions based on your understanding from the notes.
File Permissions is a crucial layer in linux environments which enables administartors to prevent the sensitive data from unauthorized users.This is crucial for security breach and data loss. It offers read,write,execute permissions to the owner,groups and others.
Structure of File Permissions
Each category of users has three types of permissions:
r- Read , w - write , x - execute
Read (r): Allows the user to view the contents of a file or list the contents of a directory.
Write (w): Allows the user to modify the contents of a file or create, rename, or delete files within a directory.
Execute (x): Allows the user to execute a file as a program or traverse a directory.
Category of users
o - owner, g - group, o-others
Owner (u): The user who owns the file or directory.
Group (g): The group associated with the file or directory.
Others (o): All users who are not the owner or members of the group.
Numeric Representation of Permissions
Read (r): Assigned a value of 4.
Write (w): Assigned a value of 2.
Execute (x): Assigned a value of 1.
Manipulating File Permissions
Linux provides several commands for manipulating file permissions:
chmod: Used to change the permissions of files and directories.
chown: Used to change the owner of files and directories.
chgrp: Used to change the group ownership of files and directories.
Task3 : Read about ACL and try out the commands getfacl
and setfacl
Access Control Lists (ACLs) extend the standard Linux file permissions system, while traditional file systems to owner, group and others is limited to file permissions - read, write and execut, ACLs provide specefic access to users or group of users beyond these basic permissions.
- It is helpful where access control is very complex.Like for example, In a group of user we have to grant access to certain users and denying access to the remaining users.
Commands:
getfacl
This command is used to generate all ACL enteries of a file/directory.
setfacl
It sets all ACL enteries in file/directory
setfacl -m u:username:permissions filename
It grants permissions to the user:"john" with read and write access to the file.txt file.
-
This command is used to remove access of user : john from file.txt
In conclusion, understanding Linux file permissions and ACLs is crucial for effective access control and system security. By mastering these concepts and commands, administrators can ensure that their systems remain secure and data remains protected.
Subscribe to my newsletter
Read articles from prince meenia directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by