Reference no: EM132300383
Linux Server Administration Assignment - File Systems and Advanced Scripting
Task - In this assignment, you will develop simple scripts to manage the user and file system whilst developing some expertise in managing a complex file system. For this assessment piece, you will utilize the virtual machines created in the previous assessment piece.
Part 1: Automated Account Management
You have been asked by your boss to prepare two shell scripts which manage user information:
1. You are to prepare a simple shell script which reads a text file called newusers.txt. The file is in the form
allen student /home/allen Allen John
jeff student /home/jeff Jeff Jackson
brett staff /home/brett Brett Wildermoth
anto staff /home/anto Antonio Buck
and creates these users on the system without any interactive input by run script one time only. To do this you will need to use the adduser(1) and passwd(1) commands. You will need to randomly produce the password and report this to the administrator.
You can assume the fields being username, group, home directory and GCOS string are separated by a single white space.
The program should output the username, group, home directory, and generated password once created.
2. Management of users is important particularly an account to change the password in every 30 days. Write a shell
(.sh) script that takes a single argument being a username, looks for the account in /etc/passwd, force the accounts above to change their password in every 30 days, and archives their home directory into a systemdate.tar.gz file. The script should also show a summary of the users usage in their home account. You will receive more marks if you avoid using the standard user management tools. systemdate should be yyyy-mm-dd-hhmm at the time of the script run.
Part 2: Practical File Systems
Create a user "assgn2' and in their home directory create the files with the following permissions.
- A file called "test.txt" , with contents "This is a test file" , include your name and student number as well. Ensure you create the file with read and write permissions for owner, group and other, but no execute permissions.
- A file called "runme.sh" that runs a simple script of your choosing, with read and execute permissions for group and other, and full read, write and execute permissions for the owner. You can make the script echo something to the user.
- A hidden file called " .test_config" , owned by root with contents "This is a test config file" , that has root read, write and execute permissions only, no other permissions set.
- A symbolic link with an absolute path to a system log file of your choosing.
- A directory called "test_dir" with the owner having full permissions to create, rename or delete files in the directory, list files and enter the directory. Group and other having permissions to only list files and enter the directory and access files within it.
Part 3: Network File System using both Fedora and Ubuntu
In this task, you need set an NFS filesharing storage. Either Fedora or Ubuntu can act as a NFS server or client. The implementation should include installing NFS server and client, /etc/exports file configuration, mounting the shared folder from server to client NFS, and finally, any change to the client mounted folder should be visible on the server's shared folder.
Document the steps taken and clearly show the decisions you made in configuring the NFS service. Include a picture to clearly illustrate the relationship between the server and the client.
Part 4: File System Management with Scripts
Now that you have a plan for the storage there are a few housekeeping matters to take care of because users tend to be somewhat liberal with their storage.
1. Write a script to make sure that user home directories and files are owned and only accessible by the owner. The script should be run by root only.
2. Finally, write a script which takes as an argument the filesystem name e.g. /home and looks for objects which are larger than 15 MB and objects that are executable, then list all these files in a file called suspicious.txt and this file to be located in /home/user_home_folder/dd-mm-yyyy.suspicious.txt. For instance, for user john would have /home/john/13-01-2019.suspicious.txt
When these files are found a summary should be produced including where they are and the size.
Rationale - This assessment task will assess the following learning outcome/s:
- be able to apply technical knowledge to manage servers.
- be able to investigate the layout of server file systems.
- be able to plan, create and manage information services.
- be able to design and write scripts to automate various server management tasks.
- be able to justify an appropriate protection strategy for data and services.
In this assignment you will develop simple scripts to manage the user and file system whilst developing some expertise in managing a complex file system.
Length: 15 - 20 pages including screenshots.