Linux Scripting for Automated Account and File System Management

Verified

Added 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.
tabler-icon-diamond-filled.svg

Contribute Materials

Your contribution can guide someone’s learning journey. Share your documents today.
Document Page
LINUX
tabler-icon-diamond-filled.svg

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
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
Document Page
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
Document Page
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
tabler-icon-diamond-filled.svg

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
The output is shown below.
Home directory archiving is shown below.
4
Document Page
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
Document Page
After, update the system by typing the below command.
Implementing the File system
Install the ZFS utility.
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
Making the File System accessible and robust
After, view the disk volume it is shown below (Thomas and Vugt, 2011).
7
Document Page
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
Document Page
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
tabler-icon-diamond-filled.svg

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
References
Edwards, C. (2013). Instant Ubuntu. Packt Publishing.
Thomas, K. and Vugt, S. (2011). Beginning Ubuntu Linux. New York, NY: Apress.
10
chevron_up_icon
1 out of 11
circle_padding
hide_on_mobile
zoom_out_icon
logo.png

Your All-in-One AI-Powered Toolkit for Academic Success.

Available 24*7 on WhatsApp / Email

[object Object]