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.