Part 1: Automated Account Management
In this assignment you will develop simple scripts to manage the user and file system whilst developing some expertise in managing a complex file system.
You have been asked by your boss to prepare two shell scripts which manage user information.
You are to prepare a simple shell script which reads a text file called users.txt. The file is in the form
dfs /home/dfs Daniel Saffioti
and creates these users on the system without any interactive input. To do this you will need to use the adduser(1) and passwd(1) commands. You will need to randomly produce the password and report this to the administrator.
You can assume the fields being username, home directory and GCOS string are separate by a single white space.
You can assume all users are in the same group.
The program should output the username and generated password once created.
You work for the Information Technology Department in your University and you have been asked to build a server to store user data (home directories).
The volumes can grow without bounds, so it was felt that the ZFS file system should be used for each volume. The operating system itself need not be on a ZFS volume.
All volumes including the operating system should be engineered in such a way to ensure the best data protection is afforded in the event of local disk failure. It is expected that no more than 1 hours worth of data will be lost.
The volumes required are as follows:
uni0 with mount point /users/ug& quota of 200G.
uni1 with mount point /users/pg& quota of 200G.
uni2 with mount point /users/deleted& reservation of 100G.
uni3 with mount point /users/staff& reservation of 100G.
uni4 with mount point /users/guest & reservation of 250G.
Given the above your task is as follows define a strategy for how you will ensure the volumes outlined above are provisioned whilst ensuring there data protection. Document this accordingly along with a suitable rationale for your design.
Given the strategy defined in part two, your job is to implement the storage system.
To do this install the latest version of Ubuntu Server on a virtual machine. You will need to ensure the networking is bridged and the root portioning is managed appropriately. You will need to add additional virtual disks to meet the storage needs above.
Install the ZFS package and configure it such that pools of storage are created to meet the above requirements including redundancy and backups. To achieve this use the mirroring and snapshot features of ZFS.
Demonstrates your filesystem working and provide any insights gained along the way.
Now that you have a plan for the storage there are a few house keeping matters to take care of because users tend to be somewhat liberal with their storage.
Write a script to make sure that user home directories are owned and only accessible by the owner. The script can assume home directories are descendants of /users.
Finally write a script which takes as an argument the filesystem name e.g. /home and looks for objects which do not belong i.e. end with the extension
a.mp3
b.aac
c.mp4
d..mov
e..avi
f..vid
When these files are found a summary should be produced including where they are and the size. The script should also remove the files.
Demonstrate each script working in your submission and document the source code and any insights gained along the way.
Part 1: Automated Account Management
First Script ``
Clear; This is first used to clear the terminal
#read the username from users.txt
un=`cat users.txt|cut -d " " -f 1`
#read the Home Directory from users.txt
hd=`cat users.txt|cut -d " " -f 2`
#read the gecos string from users.txt
g=`cat users.txt|cut -d " " -f 3-4`
#generate the random password
p=`head /dev/urandom | tr -dc A-Za-z0-9 | head -c 8 ; echo ''`
#display the password
echo "The password of user $un is $p"
#add the user by useradd command
adduser -d $hd -c "$g" $un
#assign the password and redirect the output into/dev/null
(echo $p|passwd $un --stdin) >/dev/null
echo "Enter the username"
read un
grep $un /etc/passwd
if test $? -eq 0
then
hd=`grep $un /etc/passwd|cut -d ":" -f 6`
tar -czf /tmp/back1.tar $hd
userdel -r $un
Unlike FreeBSD, ZFS is not part of the Linux base installation due to licensing issues, which is a unexpected because it would be nice to install Ubuntu on a ZFS pool.
In any case, we can still run ZFS on Linux by installing it with the following commands.
ZFS is a joined record framework and intelligent volume administrator planned and executed by a group at Sun Microsystems driven by Jeff Bonwick and Matthew Ahrens. Its advancement began in 2001 and it was authoritatively declared in 2004. In 2005 it was incorporated into the fundamental trunk of Solaris and discharged as a feature of OpenSolaris. Right now, as of January 2015, it is local to Solaris, OpenSolaris, OpenIndiana, illumos, Joyent SmartOS, OmniOS, FreeBSD, Debian GNU/kFreeBSD frameworks, NetBSD, OSv and bolstered on Mac OS with MacZFS.
On Backups, this framework is totally in light of dataset snapshots and replication back to our capacity servers utilizing zfsnap and zxfer. zfsnap takes a snapshot each day for a week and consistently for a month. It discards old ones consequently so you don't amass overabundance snapshots. For instance, the greater part of our present Jail servers' dataset get snapshotted, at that point every depiction gets repeated back to the capacity servers. It's quick.
The ZFS filesystem is accessible for Ubuntu as either a FUSE module or a local portion module. The part module is given as a matter of course. To introduce the client level instruments, just introduce:
sudo apt install zfsutils-linux or sudo apt install zfs
For every single current variant from 16.04 ahead.
Notwithstanding have the capacity to have ZFS on root, introduce:
sudo apt install zfs-initramfs
Part 2: Design of a File System
In the following example, we will create a RAIDZ-2 Storage Pool using 3 hard disks. In ZFS RAIDZ-2 is like hardware RAID 6 in that two hard disks can fail before the data on the
That is the zfs now running as proposed on a linux operating system.
Changing User access rights on ubuntu is not a big task to tackle, One needs only to be conversant with the following tips:
Utilize chown to change possession and
chmod to change rights.
utilize the - R choice to apply the rights for all documents within a catalog as well.
Note that both these charges simply work for registries as well. The - R alternative rolls out them additionally improvement the authorizations for all documents and catalogs within the registry.
For instance
chown - R username:group catalog
will change proprietorship (for the group and client as well) everything being equal and catalogs within index and registry itself.
chown username:group catalog
will just change the authorization of the organizer registry however will leave the documents and envelopes inside the catalog alone.
you have to utilize sudo to change the proprietorship from root to yourself.
sudo chown -R $USER:$USER /home/$USER/
sudo chmod -R 750 /home/$USER/
# get path
path=$1
# display files information
find $path -type f ( -name "*.mp3" -o -name "*.mp4" -o -name "*.aac" -o -name "*.mov" -o -name "*.avi" -o -name "*.vid" ) | xargs du -sh
# remove files
find $path -type f ( -name "*.mp3" -o -name "*.mp4" -o -name "*.aac" -o -name "*.mov" -o -name "*.avi" -o -name "*.vid" ) -exec rm -f {} ;
Get-ChildItem -Path C: -Force /*get path from item*/
Get-ChildItem -Path $environment:ProgramFiles -Recurse /*get the path from programming files*/
-Include *.exe | Where-Object -FilterScript /*to find the object from script*/
-and ($_.Length -ce data storage) -and ($_.Length -le data storage)
Copy-Item -Path C:boot.
ini -Destination C:boot.dat /*to copy the item from directory*/
(New-Object -script Object Scripting.FileSystemObject)
New-Item -Path 'C:tempNew Folder' -ItemType Directory /*a folder to store*/
/* Assumption of home directories are descendants of /users
Get-Data-Path C:boot.ini
[boot loader]
timeout=0
default=multi(0)disk(0)rdisk(0)partition(1)WINDOWS[operating systems]
/*The script takes an argument the filesystem name
multidata()disk()rdisk()partition(1)WINDOWS. mp3 ="receive file" /*to find the summary*/
/noexecute=AlwaysOff.aac /fastdetect /*detection of fast execution*/
multi(0)disk(0)rdisk(0)partition(1)WINDOWS.mp4="Descendants of users"
with Data Execution Prevention" /notexecuted=option /datadetect
(Get-Content -Path C:boot.initiate).Length.avi() /*to find the length of data storage*/
/*to find the initiation of argument storage*/
$System = Get-Context -Path C:temporaryDomainMembers.txt
$scl = Get-Scl fs1sharedfilesdata
$AccessData = New-Object System.Security.AccessControl.FileSystemAccessRule("FullControl","Data")
$scl.RemoveAccessDta($AccessData)
$scl | Set-Scl fs1sharedfiles
Remove-Item -Path C:tempDeleteMe /*to remove 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.
Joyent, Z. F. S. (2014). Performance Analysis and Tools. Retrieved Mar, 12.
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.
Swetha, K., & Sivakumar, A. P. (2015). A Multi-level Services for Scaling of applications in Cloud Services.
Lora, A., Nantista, G., & Pifferi, A. (2016). Setup of a redundant network storage system. A legacy approach. SMART eLAB, 8, 1-8.
Olson, J. T., Patil, S. R., Shiraguppi, R. M., & Spear, G. A. (2016). U.S. Patent No. 9,323,462. Washington, DC: U.S. Patent and Trademark Office.
Wojs?aw, D. (2017). Installation. In Introducing ZFS on Linux(pp. 41-49). Apress, Berkeley, CA.
To export a reference to this article please select a referencing stye below:
My Assignment Help. (2021). Simple Scripts For User And File System Management In An Essay.. Retrieved from https://myassignmenthelp.com/free-samples/nit2122-server-administration-and-management/implementing-the-filesystem.html.
"Simple Scripts For User And File System Management In An Essay.." My Assignment Help, 2021, https://myassignmenthelp.com/free-samples/nit2122-server-administration-and-management/implementing-the-filesystem.html.
My Assignment Help (2021) Simple Scripts For User And File System Management In An Essay. [Online]. Available from: https://myassignmenthelp.com/free-samples/nit2122-server-administration-and-management/implementing-the-filesystem.html
[Accessed 22 November 2024].
My Assignment Help. 'Simple Scripts For User And File System Management In An Essay.' (My Assignment Help, 2021) <https://myassignmenthelp.com/free-samples/nit2122-server-administration-and-management/implementing-the-filesystem.html> accessed 22 November 2024.
My Assignment Help. Simple Scripts For User And File System Management In An Essay. [Internet]. My Assignment Help. 2021 [cited 22 November 2024]. Available from: https://myassignmenthelp.com/free-samples/nit2122-server-administration-and-management/implementing-the-filesystem.html.