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 edward with both UID and GID set to 1666, and configure the home directory in /NFS/home/edward on the rocky10-1 virtual machine.

Configure Autofs on rocky10-1 Virtual Machine#

  • Set up automounting for /NFS/home on the rocky10-1 virtual machine by creating the configuration files auto.master and auto.exports within the /etc directory.

  • Connect via SSH to the rocky10-1 virtual machine from your desktop as the user edward, and verify whether /NFS/home mounts 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 master or n01). Place the receive.sh script onto the target virtual machine, place the send.sh script on your desktop, and update the ipaddr variable in send.sh to 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 shellcheck utility.

  • 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-dev on 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 1000 with N 200 inside the linpack_bench.c source file.
    (Hint: Use the sed command to match the text pattern define N followed by any arbitrary integer).

  • B) Modify the script so that it prompts the user to enter the new value for N interactively via keyboard input.