Question 3
Implement system security and access control in Linux operating system.
Using Ubuntu OS, write and implement ONE (1) bash shell script (only one script should be written for whole Question 3). Use the root account to execute the script. The script will be executed with no arguments, and it can be executed in any folder.
Hire a Professional Essay & Assignment Writer for completing your Academic Assessments
The bash shell script should have the following specifications:
Part (a)
1. The script creates a file âtma2024.txtâ in the current folder and write the following two words in the file, where x is 1 initially.
line x
If the file exists, it will prompt a message to the user on entering a word âappendâ and press enter to append the two words in the file.
2. If the user does not enter âappendâ and press enter, the script will display âuser not enter âappendââ and the script will proceed to part (b).
3. If the user enters âappendâ and press enter, the script will display the last line of âtma2024.txtâ.
If the last line does not contain âline xâ, it will display âincorrect two words formatâ. The script will then proceed to part (b).
Example, if the last line contains âhello worldâ, then the script will display âincorrect two words formatâ.
If the last line contains âline xâ, it will display âcorrect two words formatâ, increment x by 1 and append âline xâ to file âtma2024.txtâ. The script will then proceed to part (b).
Example, if the last line contains âline 5â, then the script will display âcorrect
two words formatâ and append âline 6â to file âtma2024.txtâ.
Part (b)
4. The script will then display the permissions of the file âtma2024.txtâ in the following
format.
tma2024.txt permissions [file permissions] size [file size in bytes]
Example of display: tma2024.txt permissions -rw-rw-râ size 71
5. It will change the permissions of the file âtma2024.txtâ according to the file size.
â If the file size is less than 50 bytes, remove the write permission from group.
â If the file size is between 50 bytes and 100 bytes, change the permission to
owner can read, write and execute, whereas all others can only read.
â If the file size is more than 100 bytes, add the execute permission to owner and group.
6. It will then display the current date in the format of MM#DD#YYYY.
Stuck with a lot of homework assignments and feeling stressed ?
Take professional academic assistance & Get 100% Plagiarism free papers
Part (c)
7. The script will then list all the files with the extension of .rpt (assume that .rpt is a text file) in the current folder.
8. It then prepends a # in front of all the lines in the .rpt files.
9. It then appends itself to the .rpt files (it means your bash shell script content is written to each of the .rpt files). If the .rpt file has been appended by your bash shell script before, it should not append to the .rpt files again, and it will instead print out a message to alert the user.
10. It then adds the execute permission to the .rpt files for everybody. Note that the .rpt files that are appended by your bash shell script will be able to execute exactly as your bash shell script.
11. Validation check needs to be done in the bash shell script whenever possible (e.g.
appropriate message should be shown and the script will exit if there is no .rpt files in the current folder)
Part (d)
A documentation (with appropriate screenshots and explanations) needs to be produced on the execution of the bash shell script with different conditions (e.g. on whether user enter âappendâ and press enter, different file size of file âtma2024.txtâ, etc.). Appropriate checking needs to be done (e.g. checking the size of file âtma2024.txtâ, checking the content of file âtma2024.txtâ, etc.)
Appropriate comments should be added in the script to make it easier to understand.
Buy Custom Answer of This Assessment & Raise Your Grades
The post ICT246: Operating Systems Assignment, SUSS, Singapore: Implement system security and access control in Linux operating system appeared first on My Assignment Help SG.