File Systems and Advanced Scripting Assignment - Server Administration

Verified

Added on  2023/06/07

|13
|695
|492
Homework Assignment
AI Summary
This assignment solution covers file systems and advanced scripting in a server administration context. It begins with automated account management using shell scripts, including user creation, password generation, and removal. The solution then delves into designing and implementing a file system using ZFS on an Ubuntu virtual machine, detailing the steps involved in installing and configuring ZFS. Finally, it presents scripts for file system management, focusing on user home directory ownership and searching for specific file types (MP3, MP4, AVI) within the file system. The solution includes code snippets and screenshots to illustrate the implementation and functionality of the scripts.
Document Page
SERVER
ADMINISTRATION AND
MAINTENANCE
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. Automated Account Management......................................................................................2
2. Designing File Systems......................................................................................................5
3. Implementing the File system.............................................................................................7
4. File System Management with Scripts.............................................................................10
1
Document Page
1. Automated Account Management
This task we are going to make the two shell scripts and it is used to manage the user
information. First scripts is to reads the text file called users.txt that contains the below
information.
Shell Script
#!/bin/bash
FILE="/home/ubuntu/Documents"
echo "*** File - $FILE contents ***"
cat $FILE
After run the shell scripts and it is provide the output. It is displayed below,
2
Document Page
After, we will assume the users on the system without any interactive input. It is shown
below.
The Second script is to remove the user account by using the following script.
#!/bin/bash
#
for user
do
userdel r $user
done
#
for user1
do
rm -rM /home/$user1
done
#
The output 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
Home directory archiving is shown below.
4
Document Page
2. Designing File Systems
Here, we will needs to build the server to store the user data by using the ZFS volume.
First, user needs to install the ZFS by using the following steps.
First, view the sources are enabled or not by enter the following command and it is illustrated
as below.
5
Document Page
After, update the system by enter the following command.
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
3. Implementing the File system
In this task, we are going to implement the storage system by install the ZFS and
Ubuntu virtual machine. First, user needs to Install Ubuntu virtual Machine.
7
Document Page
Then install the ZFS utility.
After, view the disk volume 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
4. File System Management with Scripts
Here, we will created 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.
for dir in /home/ubuntu*
do
if [ -d "$dir" ]
then
username=$(basename "$dir")
echo "chown -R $username $dir"
fi
done
The second scripts is to looks the file system to find the objects like mp3, mp4, aac, vid and
mov files. 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 \
10
Document Page
--add-id3v2 --tt "$TITLE" --ta "$ARTIST" --tl "$ALBUM" \
--ty "$DATE" --tn "$TRACKNUMBER" --tg "$GENRE" \
- "$outfile"
#Search MP4
find $HOME -name "*.mp4" -group vivek
#Search Video Files#
find /home/directory -type f -exec file -N -i -- {} + |
sed -n 's!: video/[^:]*$!!p'
find /tmp /var/tmp ~ -type f -size +10M \
-mtime +60 -ctime -100 \
-exec file -N -i -- {} + |
sed -n 's!: video/[^:]*$!!p'
#Search .avi files
#!/bin/sh
cd /media/Media/
files=$(find . -type f -iname *.avi -exec echo '{}' +)
cd /media/Media/Xbox360
for avifiles in "$files[@]"; do
ln -s $avifiles .
done
exit 0
11
chevron_up_icon
1 out of 13
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]