#task1: Create a simple file and do ls -ltr
to see the details of the files
The most important factor for every organization is security. Linux is widely known for its security factor.
Linux ensures security and control over sensitive data (files ) & directories. Linux allows administrators to manage the access for users and groups.
To understand file permission we will create a simple file
ls -ltr
to see the details of the files
Now, if I use ls -l
, it will display one entry per line, still sorted in alphabetical order.
abhishek@itsfoss:~/Apps$ ls -l
total 304804
-rwxr-xr-x 1 abhishek abhishek 89697412 Feb 3 2021 balenaEtcher-1.5.116-x64.AppImage
drwxr-xr-x 6 abhishek abhishek 4096 Jul 23 2021 cpufetch
-rwxr-xr-x 1 abhishek abhishek 90800704 Jan 24 11:05 Obsidian-0.13.19.AppImage
-rwxr-xr-x 1 abhishek abhishek 57430439 Mar 17 07:52 pcloud
drwxr-xr-x 2 abhishek abhishek 4096 Mar 20 2021 PenguinSubtitlePlayer-Linux
-rwxr-xr-x 1 abhishek abhishek 74170408 Feb 13 20:26 ScreenCloud-v1.5.3-x86_64.AppImage
Pay attention to the time and date. I am going to sort ls command output by size in long listing with ls -lt
:
abhishek@itsfoss:~/Apps$ ls -lt
total 304804
-rwxr-xr-x 1 abhishek abhishek 57430439 Mar 17 07:52 pcloud
-rwxr-xr-x 1 abhishek abhishek 74170408 Feb 13 20:26 ScreenCloud-v1.5.3-x86_64.AppImage
-rwxr-xr-x 1 abhishek abhishek 90800704 Jan 24 11:05 Obsidian-0.13.19.AppImage
drwxr-xr-x 6 abhishek abhishek 4096 Jul 23 2021 cpufetch
drwxr-xr-x 2 abhishek abhishek 4096 Mar 20 2021 PenguinSubtitlePlayer-Linux
ls -lrt
as the addition of option r
will reverse the sorting (by time):
abhishek@itsfoss:~/Apps$ ls -lrt
total 304804
-rwxr-xr-x 1 abhishek abhishek 89697412 Feb 3 2021 balenaEtcher-1.5.116-x64.AppImage
drwxr-xr-x 2 abhishek abhishek 4096 Mar 20 2021 PenguinSubtitlePlayer-Linux
drwxr-xr-x 6 abhishek abhishek 4096 Jul 23 2021 cpufetch
-rwxr-xr-x 1 abhishek abhishek 90800704 Jan 24 11:05 Obsidian-0.13.19.AppImage
-rwxr-xr-x 1 abhishek abhishek 74170408 Feb 13 20:26 ScreenCloud-v1.5.3-x86_64.AppImage
-rwxr-xr-x 1 abhishek abhishek 57430439 Mar 17 07:52 pcloud
#task2: Write an article about File Permissions
In Linux and other Unix-like operating systems, file permissions are used to control which users and groups can access and modify files and directories.
Three basic types of permissions can be set for a file or directory:
Read permission (r): This permission allows a user or group to view the contents of a file or directory. For directories, it also allows the user or group to list the files and subdirectories in the directory.
Write permission (w): This permission allows a user or group to modify the contents of a file or directory. For directories, it also allows the user or group to create, delete, and rename files and subdirectories in the directory.
Execute permission (x): This permission allows a user or group to execute a file (if it is a program or script) or to access a directory and its contents (if it is a directory).
Each file or directory in Linux has three sets of permissions, one for the owner of the file, one for the group that owns the file, and one for all other users. These permissions can be set using numeric or symbolic notation.
Numeric notation uses a three-digit code to represent the permissions for each of the three sets. The first digit represents the permissions for the owner, the second digit represents the permissions for the group, and the third digit represents the permissions for all other users. The values of the digits can range from 0 to 7, with 0 representing no permissions and 7 representing all permissions.
Symbolic notation uses a combination of letters and symbols to represent the permissions. The letters "r", "w", and "x" represent read, write, and execute permissions, respectively. The symbols "+" and "-" are used to add or remove permissions, and the symbol "=" is used to set the permissions to a specific value.
example: For add read write permission to group
#
chmod g+rw /test.txt
#task3: Read about ACL and try out the commands getfacl
and setfacl
ACL is a service that is used for providing special permission to specific Users & Groups for particular files and directories. ACLs can set read, write, and execute permissions for the owner, group, and other users.
getfacl
- To check the Access Control permission.
setfacl
- command is used to set ACL permission.
Thank you for reading!
Contact me at :
linkedin: https://www.linkedin.com/in/sutish-pradhan/
E-mail: psutish@gmail.com