Linux Server Administration: Automating User Accounts & ZFS Volumes

Verified

Added on  2023/06/07

|10
|1096
|123
Practical Assignment
AI Summary
This practical assignment focuses on Linux server administration, detailing the automation of user account management using shell scripts, including reading usernames, home directories, and GECOS strings from a file, generating passwords, and adding users with appropriate configurations. It further explores file system design, user deletion, and the installation of ZFS utilities, demonstrating the setup of a ZFS RAID 0 pool. The assignment also covers network connectivity checks, mounting shared directories, and implementing ZFS volume backup processes through snapshots, including sending backups to remote machines. Finally, it delves into file system management with scripts, showcasing techniques for retrieving file information, duplicating items, creating directories, and modifying file system access controls, with references to relevant academic literature.
tabler-icon-diamond-filled.svg

Contribute Materials

Your contribution can guide someone’s learning journey. Share your documents today.
Document Page
Running Head: SERVER ADMINISTRATION 1
Linux and Server
Institution
Date
Name
Section 1: Automated Account Management (4 marks)
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
SERVER ADMINISTRATION
First Script
Clear
Reading the Username from the users.txt file:
un=`cat users.txt|cut -d " " -f 1`
Reading the the Home Directory from users.txt:
hd=`cat users.txt|cut -d " " -f 2`
Reading the gecos string from users.txt:
g=`cat users.txt|cut -d " " -f 3-4`
Coming up with the arbitrary password:
pass=head /dev/urandom | tr -dc A-Za-z0-9 | head -c 8 ; echo '''
Show/display the Password on the screen:
echo "The password of user $un is $pass"
Adding the user by useradd command:
adduser -d $hd -c "$g" $un
Assigning the password and redirecting the output into/dev/null:
(echo $p|passwd $un --stdin) >/dev/null
Section 2. Designing a File system
echo "Enter your username"
Document Page
SERVER ADMINISTRATION
read usnme
grep $usnme /etc/passwd
if test $? -eq 0
then
hd=`grep $usnme /etc/passwd|cut -d ":" -f 6`
tar -czf /tmp/back1.tar $hd
userdel -r $usnme
PART 3:
Install ZFS utility
Document Page
SERVER ADMINISTRATION
Setting Up ZFS RAID 0 Pool
Create ZFS pool files in RAID 0 setup.
Section 4:
First we must check the connectivity between the server:
# ping <IP of the Server>
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
SERVER ADMINISTRATION
If the connectivity is working fine, then run the following command to check
what are the files that has been shared by the server:
# showmount –e <Server_name>
If you see that there is a shared directory, you need to mount it in your newly
created server:
Create a directory where you want to mount the files:
# mkdir /mount
Now edit the /etc/fstab file to permanently mount in your local server:
# vi /etc/fstab
Document Page
SERVER ADMINISTRATION
Go to the last line and edit
<Server_name>:/Shared_directory /mount nfs defaults 0 0
Now run the below script to finish the step:
# mount -a
ZFS volume back up process:
ZFS actually helps the administrator to perform inexpensive snapshots of already
present mounted file system. A photo of the ZFS files system at a given point.
Now to perform a backup of the ZFS volumes, you need to take a snapshot.
Below is the command of taking a snapshot:
# pfexec zfs snapshot <zpool_name>/<filesystem_name>@snapshot_name
Now check whether the snapshot is taken correctly or not:
Document Page
SERVER ADMINISTRATION
# zfs list –t snapshot
The Next step is to take the backup of the snapshot. So run the following
command:
Here we are dumping the snapshot using a This command:
# pfexec zfs send <zpool_name>/ <filesystem_name>@snapshot_name >
backup_file
This file has entire ZFS mounted volumes along with the files and metadata.
Suppose you want to send the backup to another machine, then Execute:
# zfs send <zpool_name>/<filesystem_name>@snapshot_name | ssh
remote_host zfs receive <zpool_name1>/<filesystem_name>
Section 5: File System Management with Scripts.
Get-ChildItem - Path C:\ - Force/*get way from item*/
Get-ChildItem - Path $environment:ProgramFiles - Recurse/*get the way from
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
SERVER ADMINISTRATION
programming files*/
- Include *.exe | Where-Object - FilterScript/*to discover the protest from
script*/
- and ($_.Length - ce information stockpiling) - and ($_.Length - le information
stockpiling)
Duplicate Item - Path C:\boot.
ini - Destination C:\boot.dat/*to duplicate the thing from directory*/
(New-Object - scriptObject Scripting.FileSystemObject)
New-Item - Path 'C:\temp\New Folder' - ItemType Directory/*a organizer to
store*/
/* Assumption of home indexes are relatives of/clients
Get-Data-Path C:\boot.ini
[boot loader]
timeout=0
Document Page
SERVER ADMINISTRATION
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS[operating systems]
/*The content takes a contention the filesystem name
multidata()disk()rdisk()partition(1)\WINDOWS. mp3 ="receive document"/*to
discover the summary*/
/noexecute=AlwaysOff.aac/fastdetect/*detection of quick execution*/
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS.mp4="Descendants of clients"
with Data Execution Prevention"/notexecuted=option/datadetect
(Get-Content - Path C:\boot.initiate).Length.avi()/*to discover the length of
information storage*/
/*to discover the commencement of contention storage*/
$System = Get-Context - Path C:\temporary\DomainMembers.txt
$scl = Get-Scl \\fs1\shared\files\data
$AccessData
System.Security.AccessControl.FileSystemAccessRule("FullControl","Data")
$scl.RemoveAccessDta($AccessData)
Document Page
SERVER ADMINISTRATION
$scl | Set-Scl \\fs1\shared\files
Evacuate Item - Path C:\temp\DeleteMe/*to expel files*/
References
Ab Karim, M. B., Luke, J. Y., Wong, M. T., Sian, P. Y., & Hong, O. (2016, October).
Ext4, XFS, BtrFS and ZFS Linux file systems on RADOS Block Devices
(RBD): I/O performance, flexibility and ease of use comparisons. In Open
Systems (ICOS), 2016 IEEE Conference on (pp. 18-23). IEEE.
LaCroix, J. (2016). Mastering Ubuntu Server. Packt Publishing Ltd.
Shen, Y., & Luo, L. (2014, December). Fwrite: An Approach to Optimize Write
Performance of ZFS on Linux. In Computational Intelligence and Design
(ISCID), 2014 Seventh International Symposium on (Vol. 2, pp. 57-60). IEEE.
Lora, A., Nantista, G., & Pifferi, A. (2016). Setup of a redundant network storage
system. A legacy approach. SMART eLAB, 8, 1-8.
Wojsław, D. (2017). Installation. In Introducing ZFS on Linux(pp. 41-49). Apress,
Berkeley, CA.
chevron_up_icon
1 out of 10
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]