Linux Server Administration Assignment: User and File System Tasks

Verified

Added on  2023/06/06

|11
|695
|90
Practical Assignment
AI Summary
This assignment solution focuses on Linux server administration, encompassing user and file system management. It begins with shell scripts for automatic user account management, including creating and deleting user accounts, and archiving home directories. The assignment then delves into file system design using ZFS, detailing the installation and configuration steps. It covers creating a ZFS volume, making the file system accessible, and ensuring its robustness. Finally, the solution presents scripts for managing the file system, such as creating user home directories and searching for specific file types (MP3, MP4, AVI) within the system. The provided scripts demonstrate practical applications of file system administration tasks. This solution is available on Desklib, a platform providing AI-based study tools and past papers for students.
Document Page
linux server administration
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 Automatic Management of Account...................................................................................2
2 File System Designing........................................................................................................4
3 File system Implementation................................................................................................6
4 Making the File System accessible and robust...................................................................7
5 Management of File System using the Scripts....................................................................8
1
Document Page
1 Automatic Management of Account
This task creates a couple of shell scripts that are utilized for managing the
information of the user. Initially, the shell script will be utilized to read the text file named as,
users.txt, which has the following information as shown in the below figure.
The Shell Script includes the following:
#!/bin/bash
FILE="/home/ubuntu/Documents"
echo "*** File - $FILE contents ***"
cat $FILE
Later, the scripts must be run, as shown in the following figure.
./user.sh
On the system, the users are deprived of any form of interactive inputs with the help of the
following command.
2
Document Page
For removing the user account, the second script is used, as follows:
#!/bin/bash
#
for user
do
userdel r $user
done
#
for user1
do
rm -rM /home/$user1
done
#
The following with be the output.
The following figure represents the archiving of Home directory.
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
2 File System Designing
This task requires building a server for storing the user data, with the help of ZFS
volume. Initially, the user requires ZFS installation with the help of the below mentioned
steps. The primary thing to be done includes, enter the following command and view whether
the sources are enabled or not.
4
Document Page
5
Document Page
After, update the system by entering the under command.
3 File system Implementation
Here, the ZFS utility must be installed.
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
4 Making the File System accessible and robust
Later, as the following figure view the disk volume.
7
Document Page
Then, a pool with the name, pool-name must be created.
At last, the design of ZFS volume is successfully designed by the user.
5 Management of File System using the Scripts
This specific task also creates a couple of scripts to manage the file system. The
primary script is used for making the user home directories which are just owned and
accessed 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"
#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 '{}' +)
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
cd /media/Media/Xbox360
for avifiles in "$files[@]"; do
ln -s $avifiles .
done
exit 0
10
chevron_up_icon
1 out of 11
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]