File Systems and Advanced Scripting Assignment - Server Administration
VerifiedAdded 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.

SERVER
ADMINISTRATION AND
MAINTENANCE
ADMINISTRATION AND
MAINTENANCE
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

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
1. Automated Account Management......................................................................................2
2. Designing File Systems......................................................................................................5
3. Implementing the File system.............................................................................................7
4. File System Management with Scripts.............................................................................10
1

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
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
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

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
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
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

Home directory archiving is shown below.
4
4

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
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
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

After, update the system by enter the following command.
6
6
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

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
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

Then install the ZFS utility.
After, view the disk volume and it is illustrated as below.
8
After, view the disk volume and it is illustrated as below.
8
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

After, create the pool named as pool-name. It is displayed as below.
Finally user successfully designed the ZFS volume.
9
Finally user successfully designed the ZFS volume.
9
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

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
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

--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
--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
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide
1 out of 13
Related Documents

Your All-in-One AI-Powered Toolkit for Academic Success.
 +13062052269
info@desklib.com
Available 24*7 on WhatsApp / Email
Unlock your academic potential
Copyright © 2020–2025 A2Z Services. All Rights Reserved. Developed and managed by ZUCOL.