Linux Scripting for Automated Account and File System Management
VerifiedAdded on  2023/06/07
|11
|647
|305
Practical Assignment
AI Summary
This assignment focuses on using Linux shell scripts to automate user account management and file system tasks. It includes creating scripts for adding and removing users, managing user home directories, and designing a ZFS volume for data storage with redundancy. The assignment details the steps for installing ZFS, creating storage pools, and ensuring data protection. Additionally, it presents scripts to manage file system permissions and locate specific file types, such as MP3 files. The document provides practical examples and commands for implementing these scripts in a Linux environment. Desklib is a platform where students can find solved assignments and study tools.

LINUX
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

Table of Contents
Automated Account Management..............................................................................................2
Designing File Systems..............................................................................................................5
Implementing the File system....................................................................................................6
Making the File System accessible and robust..........................................................................7
File System Management with Scripts.......................................................................................8
References................................................................................................................................10
1
Automated Account Management..............................................................................................2
Designing File Systems..............................................................................................................5
Implementing the File system....................................................................................................6
Making the File System accessible and robust..........................................................................7
File System Management with Scripts.......................................................................................8
References................................................................................................................................10
1

Automated Account Management
Here, we will creates the two shell scripts which is used to manage the user
information. First shell script is used for reads the text file called users.txt that contains the
below information (Edwards, 2013).
Shell Script is shown below.
#!/bin/bash
FILE="/home/ubuntu/Documents"
echo "*** File - $FILE contents ***"
cat $FILE
Run the shell script by using the below steps.
Open terminal.
Go to script location by using the cd command.
After, gives the permission by enter the below command.
chmod +x user.sh
Finally, run the shell scripts by enter the following command.
./user.sh
It is shown below.
2
Here, we will creates the two shell scripts which is used to manage the user
information. First shell script is used for reads the text file called users.txt that contains the
below information (Edwards, 2013).
Shell Script is shown below.
#!/bin/bash
FILE="/home/ubuntu/Documents"
echo "*** File - $FILE contents ***"
cat $FILE
Run the shell script by using the below steps.
Open terminal.
Go to script location by using the cd command.
After, gives the permission by enter the below command.
chmod +x user.sh
Finally, run the shell scripts by enter the following command.
./user.sh
It is shown below.
2
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

After, users on the system without any interactive input by using the below command.
Second script is to remove the user account. The script is displayed below.
#!/bin/bash
#
for user
do
userdel r $user
done
#
for user1
do
rm -rM /home/$user1
done
#
3
Second script is to remove the user account. The script is displayed below.
#!/bin/bash
#
for user
do
userdel r $user
done
#
for user1
do
rm -rM /home/$user1
done
#
3
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

The output is shown below.
Home directory archiving is shown below.
4
Home directory archiving is shown below.
4

Designing File Systems
This task 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. First, view the sources are enabled or not by enter the following command.
5
This task 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. First, view the sources are enabled or not by enter the following command.
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 typing the below command.
Implementing the File system
Install the ZFS utility.
6
Implementing the File system
Install the ZFS utility.
6
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

Making the File System accessible and robust
After, view the disk volume it is shown below (Thomas and Vugt, 2011).
7
After, view the disk volume it is shown below (Thomas and Vugt, 2011).
7

After, create the pool named as pool-name.
Finally user successfully designed the ZFS volume.
File System Management with Scripts
This task also 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.
for dir in /home/ubuntu*
do
if [ -d "$dir" ]
8
Finally user successfully designed the ZFS volume.
File System Management with Scripts
This task also 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.
for dir in /home/ubuntu*
do
if [ -d "$dir" ]
8
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

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. 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" \
--ty "$DATE" --tn "$TRACKNUMBER" --tg "$GENRE" \
- "$outfile"
9
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. 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" \
--ty "$DATE" --tn "$TRACKNUMBER" --tg "$GENRE" \
- "$outfile"
9
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

References
Edwards, C. (2013). Instant Ubuntu. Packt Publishing.
Thomas, K. and Vugt, S. (2011). Beginning Ubuntu Linux. New York, NY: Apress.
10
Edwards, C. (2013). Instant Ubuntu. Packt Publishing.
Thomas, K. and Vugt, S. (2011). Beginning Ubuntu Linux. New York, NY: Apress.
10
1 out of 11
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.