Homework 6: NFS Client on Rocky Linux and Shell Scripting Exercises#
Due Date: Tuesday, October 20, 2026
User Account on rocky10-1 Virtual Machine#
Create a user account named
edwardwith both UID and GID set to1666, and configure the home directory in/NFS/home/edwardon therocky10-1virtual machine.
Configure Autofs on rocky10-1 Virtual Machine#
Set up automounting for
/NFS/homeon therocky10-1virtual machine by creating the configuration filesauto.masterandauto.exportswithin the/etcdirectory.Connect via SSH to the
rocky10-1virtual machine from your desktop as the useredward, and verify whether/NFS/homemounts automatically upon access.
Netcat Server and Client Exercises#
Review the two shell scripts provided below:
Script send.sh:
#!/bin/bash
ipaddr='192.168.122.11'
port='9092'
echo "provide input file name"
read fname
/bin/cat "$fname" | /bin/netcat -N "$ipaddr" $port
Script receive.sh:
#!/bin/bash
DIR='/home/hostadm'
fname='fileget.out'
port='9092'
if [ -s "$DIR/$fname" ]
then
echo 'file exists'
else
/bin/netcat -N -l "$port" > "$DIR/$fname"
fi
A) Analyze both scripts and explain their overall functionality and interaction.
B) Provision a new virtual machine or utilize an existing one from your environment (such as
masterorn01). Place thereceive.shscript onto the target virtual machine, place thesend.shscript on your desktop, and update theipaddrvariable insend.shto match the IP address of your target virtual machine. Execute both scripts to securely transmit a file from the desktop to the virtual machine.
Shell Script with Syntax Errors#
Examine the following flawed script:
#!/bin/bash
cmmd= /usr/bin/md5sum
for i in $(ls /etc); do
if [ ! -d /etc/$i ] then
$cmmd /etc/$i
fi
done
This script fails to execute successfully due to several syntactic errors.
A) Identify and list the errors present in the script by running it through the
shellcheckutility.B) Explain the intended purpose and behavior of the script once the syntax errors are corrected.
Searching for Files in a Debian Package Using Grep#
Install the development package
libgpg-error-devon your desktop environment.Identify the names of the files included in this package that end with the extensions
.a,.so, and.h.Document the exact terminal commands used to locate and filter these file names.
String Replacement Using Sed and Regular Expressions#
Download the source tarball archive from the course repository at:
http://linuxcourse.rutgers.edu/summer2023/html/Final/linpack_bench.tgz
Extract the contents of the archive.
Create a shell script named replace.sh:
A) Write instructions within the script to replace the configuration value
N 1000withN 200inside thelinpack_bench.csource file.
(Hint: Use thesedcommand to match the text patterndefine Nfollowed by any arbitrary integer).B) Modify the script so that it prompts the user to enter the new value for
Ninteractively via keyboard input.