Day 6 Task: File Permissions and Access Control Lists
1. Create a simple file and do ls -ltr to see the details of the files
ls-- command is used to show only the name of directory/text files. l--command is used to the listing of directory/files name with owner, group, time and permission details in column-wise .t--command is used to sort the list of directory/files by new time to old time.r-- command is used to reverse the sort from old time to new time.
Please find below this line:-
drwxr-xr-x 5 deepa deepa 4096 Apr 28 19:29 deepa_git
'd'--indicates the directory.If You can see '-' it indicates file name.'rwxr-xr-x' 9 character indicates file permission.
'r' indicates reading permission for the directory.'w' indicates writing permission.'x' indicates execute permission.
'deepa' indicates owner of this directory.'deepa' indicates a belonging group name. Next column indicates the size of the directory. Next column indicates the time of the creation of the directory. Last column indicates the name of directory.
Three type user is there-
Owner-Creator of file/directory. Group-The directory/file belongs to the group. Other-the directory/file does not belong to the group.
"chown" is used to change the ownership permission of a file or directory.
\>> sudo chown < other ownership name > <file /directory name>
"chgrp" is used to change the group permission of a file or directory.
\>> sudo chgrp < other group name > <file/directory name>
Write an article about File Permissions based on your understanding from the notes.
\>> 'r' (4) --indicates reading permission for the directory.'w' (2) indicates writing permission.'x' (1) indicates execute permission.
exp : sudo chmod 441 my_dir
4 -- indicate write permission for this directory.1-- indicates execute permission.
If you give executable permission then, the file colour will be green.
\>> Owner-Creator of file/directory. Group-The directory/file belongs to the group. Other-the directory/file does not belong to the group.
If you want to change ownership of the directory/files then use "chown" command to follow below format.
>> sudo chown < other ownership name > <file /directory name>
If you want to change ownership of the directory/files then use "chown" command to follow below format."chgrp" command to follow the below format.
>> sudo chgrp < other group name > <file/directory name>
Read about ACL and try out the commands getfacl and setfact
To run ACL command , you have to install ACL packeges on your system follow below-
With ACLs, you can grant or deny access to files and directories for specific users and groups.
To view owner of file and group of file and file permission by 'getfacl' command.
getfacl <file/directory name>
'setfacl' command is used for modify, remove access control list of file/directory.
setfacl -m -x -R -b {user/group} {r,w,x} <file name/directory name>
"-m" or "--modify": Modify the ACL of the specified file or directory.
"-x" or "--remove": Remove the specified ACL entries from the ACL of the file or directory.
"-R" or "--recursive": Apply the specified ACL to the specified directory and all its contents recursively.
"-b" or "--remove-all": Remove all ACL entries from the specified file or directory.