Day 6 Task: File Permissions and Access Control Lists


Here we come with the Day06 task
File permissions are rules that determine who can access, modify, or execute a file on a computer. In Unix-like systems, permissions include read (r), write (w), and execute (x) for the owner, group, and others. These permissions help ensure data security by controlling access to files and directories.
ACL set of rules associated with a file or directory that specifies which users or system processes are granted access and what operations are allowed on given objects. ACLs provide more fine-grained control over permissions than the traditional Unix file permissions, allowing specific users or groups to have customized access rights to a file or directory.
Practical commands:
Note: when we create a directory by default permission is 755.
when we create a file by default permission is 644.
File permissions commands:
Let's break down the file permissions in below screenshots,
fruits.txt:
-rw-r--r--
: This represents the file permissions. In this case:Owner (root): read and write permissions (
rw-
).Group (root): read-only permission (
r--
).Others: read-only permission (
r--
).
1
: Indicates the number of hard links to the file.root
: Indicates the owner of the file.root
: Indicates the group associated with the file.0
: Represents the file size in bytes.Nov 18 10:30
: Indicates the last modification date and time.fruits.txt
: The name of the file.
vehicles.txt:
-rw-r--r--
: File permissions, similar to fruits.txt.1
: Number of hard links to the file.root
: Owner of the file.root
: Group associated with the file.0
: File size in bytes.Nov 18 10:30
: Last modification date and time.vehicles.txt
: The name of the file.
a. To change the permissions we are using chmod which stand for ChangeMod
chmod 755 fruits.txt
b. To change the ownership of the file we will use chown which stands for ChangeOwnership
The basic syntax of the chown
command is as follows:
chown [options] new_owner:new_group filename
new_owner
: The username or user ID of the new owner.new_group
: The group name or group ID of the new group.file(s)
: The file or files whose ownership is being changed.
Please find the screenshot for the same,
Setfacl and getfacl commands
Getfacl command:
Setfacl command
Subscribe to my newsletter
Read articles from Shivani Gadekar directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
