Linux File Systems and Scripting: Automated Account Management

Verified

Added on  2023/06/07

|12
|721
|455
Practical Assignment
AI Summary
This assignment focuses on Linux file system management and advanced scripting. It includes three main parts: automated account management, designing file systems using ZFS volumes, and file system management with scripts. The first part involves creating shell scripts to manage user information, including adding and removing users. The second part details the process of building a server to store user data using ZFS, ensuring data protection in the event of disk failure. The final part involves creating scripts for file system management, specifically to ensure user home directories are owned and accessible only by the owner, and to find specific file types within the file system. The assignment provides detailed steps and commands for each task, along with example scripts and outputs.
Document Page
LINUX FILE SYSTEM
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Table of Contents
1. Part 1: Automated Account Management...........................................................................2
2. Part 2: Designing File Systems...........................................................................................6
3. Part 3: File System Management with Scripts..................................................................10
References................................................................................................................................11
1
Document Page
1. Part 1: Automated Account Management
Here, we will prepare the two shell scripts which manage the user information. First,
we needs to prepare the simple shell script for reads the text file called users.txt that contains
the below information (Dalheimer & Welsh, 2009).
Shell Script
#!/bin/bash
FILE="/home/ubuntu/Documents"
echo "*** File - $FILE contents ***"
cat $FILE
To run the shell script by follows the below steps,
Open terminal and go to script location by using the cd command.
After, provide the permission by using the below common.
chmod +x user.sh
2
Document Page
Finally, run the shell scripts by enter the following command.
./user.sh
It is provide the output and it is shown below.
After, we will assume the users on the system without any interactive input by use the below
command and it is shown below.
3
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Second script is to remove the user account by using the below script.
#!/bin/bash
#
for user
do
userdel r $user
done
#
for user1
do
rm -rM /home/$user1
done
#
The output is shown below.
Home directory archiving is shown below.
4
Document Page
5
Document Page
2. Part 2: Designing File Systems
Here, we will needs to build the server to store the user data by using the ZFS volume.
The volumes are grow the without bounds and it was felt that the ZFS system and this system
should be used for each volume. The OS itself needs not be on a ZFS volume. All the ZFS
volumes are should be engineered in such a way to ensure the protection of data and it
afforded in the event of local disk failure. First, user needs to install the ZFS by using the
following steps (Hales, 2013).
First, view the sources are enabled or not by enter the following command and it is illustrated
as below.
6
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
After, updates the system by enter the following command.
Then install the ZFS utility.
7
Document Page
After, view the disk volumes by enter the following command and it is illustrated as below.
8
Document Page
After, create the pool named as pool-name. It is displayed as below.
Finally user successfully designed the ZFS volume.
9
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
3. Part 3: File System Management with Scripts
Here, we will create the two scripts for file system management. The First scripts is to
make the user home directories are owned and only accessible by the owner. It is shown
below (Thomas & Vugt, 2011).
for dir in /home/ubuntu*
do
if [ -d "$dir" ]
then
username=$(basename "$dir")
echo "chown -R $username $dir"
fi
done
The second script is to looks the file system to find the objects like mp3. It is shown below.
#!/bin/sh
file="$1"
outfile=${file%.flac}.mp3
eval $(metaflac --export-tags-to - "$file" | sed "s/=\(.*\)/='\1'/")
flac -cd "$file" | lame --preset fast extreme \
--add-id3v2 --tt "$TITLE" --ta "$ARTIST" --tl "$ALBUM" \
10
Document Page
--ty "$DATE" --tn "$TRACKNUMBER" --tg "$GENRE" \
- "$outfile"
References
Dalheimer, M., & Welsh, M. (2009). Running Linux. Sebastopol: O'Reilly Media,
Inc.
Hales, J. (2013). Linux.
Thomas, K., & Vugt, S. (2011). Beginning Ubuntu Linux. New York, NY: Apress.
11
chevron_up_icon
1 out of 12
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]