BCSL063 Solved Question Paper
BACHELOR OF COMPUTER APPLICATIONS (BCA) IGNOU Term-End Practical Examination December, 2016 BCSL063 : OPERATING SYSTEM CONCEPTS AND NETWORK MANAGEMENT LAB . Solved Previous Years Question Paper
BACHELOR OF COMPUTER APPLICATIONS (Revised) (BCA) Term-End Practical Examination December, 2016
BCSL-063 : OPERATING SYSTEM CONCEPTS AND NETWORK MANAGEMENT LAB
1. Assume there is a network of Unix/Linux machines in a lab. As a system administrator of this lab, delete the files from all the users' home directories containing characters i.e., $, *, @.
Sol:
#!/bin/bash
# Script to delete files with $, *, or @ in filenames from user home directories
# Ensure script is run as root
if [ "$EUID" -ne 0 ]; then
echo "Please run this script as root."
exit 1
fi
# Get list of regular users (UID ≥ 1000), exclude root and system users
users=$(getent passwd | awk -F: '$3 >= 1000 {print $1}' | grep -v '^root$')
for user in $users; do
home_dir="/home/$user"
# Check if home directory exists
if [ -d "$home_dir" ]; then
echo "Processing $home_dir..."
# Find and log matching files
find "$home_dir" -type f \( -name '*\$*' -o -name '*\**' -o -name '*@*' \) -print > "$home_dir/special_files_log.txt"
# Delete the matching files with interactive prompt
find "$home_dir" -type f \( -name '*\$*' -o -name '*\**' -o -name '*@*' \) -print0 | xargs -0 rm -i
echo "Finished processing $user's directory. Log saved at $home_dir/special_files_log.txt"
fi
done
echo "All user directories scanned and files deleted (if any)."
Step-by-Step Explanation
#!/bin/bash
This is called a shebang.
It tells the system to use the Bash shell to execute the script.
# Ensure script is run as root
if [ "$EUID" -ne 0 ]; then
echo "Please run this script as root."
exit 1
fi
Checks if the script is being run as root (EUID = 0 means root user).
If not, it prints a message and exits.
Required because only root can access all user directories and delete their files.
users=$(getent passwd | awk -F: '$3 >= 1000 {print $1}' | grep -v '^root$')
Fetches a list of all non-system, non-root users (UID ≥ 1000).
Excludes root explicitly using grep -v '^root$'.
Stores their usernames in the users variable.
for user in $users; do
Starts a loop to go through each user in the list.
home_dir="/home/$user"
Sets the variable home_dir to the user's home directory path, e.g., /home/john.
if [ -d "$home_dir" ]; then
Checks if the home directory actually exists.
Skips the user if the directory is missing.
echo "Processing $home_dir..."
Displays a message to show which user directory is being scanned.
find "$home_dir" -type f \( -name '*\$*' -o -name '*\**' -o -name '*@*' \) -print > "$home_dir/special_files_log.txt"
Uses the find command to search for files (not folders) in the home directory.
The -name options search for files with:
Dollar sign ($)
Asterisk (*)
At symbol (@)
Parentheses group the conditions.
-print prints the matching file paths.
> sends the output to a log file in the user's home directory (special_files_log.txt).
find "$home_dir" -type f \( -name '*\$*' -o -name '*\**' -o -name '*@*' \) -print0 | xargs -0 rm -i
This line deletes the matching files, but asks before deleting each one (-i means interactive).
-print0 and xargs -0 handle file names with spaces or newlines safely.
echo "Finished processing $user's directory. Log saved at $home_dir/special_files_log.txt"
Tells the user that scanning and deletion for that directory is done.
Mentions where the log file is saved.
done
echo "All user directories scanned and files deleted (if any)."
Ends the loop.
Final message after processing all users.
2. Configure a DNS Server as a Root Name Server in Windows 2000 Server. Demonstrate step-by-step procedure.
Sol: Steps to Configure DNS as a Root Name Server in Windows 2000 Server
Step 1: Install DNS Server Service
Go to Control Panel → Add/Remove Programs → Add/Remove Windows Components.
Select Networking Services and click Details.
Check Domain Name System (DNS) and click OK.
Click Next to install the DNS service.
Once completed, click Finish.
Step 2: Open the DNS Management Console
Go to Start → Programs → Administrative Tools → DNS.
The DNS Manager window opens.
Step 3: Create a New Root Zone
In DNS Manager, right-click on the server name and select New Zone.
The New Zone Wizard appears. Click Next.
Select Primary Zone and click Next.
When asked for the Zone Name, enter a single dot (.) to indicate the root zone.
Click Next, and specify the name of the zone file (by default, it's . stored as dot.dns). Click Next.
Choose Do not allow dynamic updates. Click Next, then Finish.
Step 4: Delete the Root Hints
In DNS Manager, expand the server name, then expand Properties.
Go to the Root Hints tab.
Select all root hints entries and click Remove.
Click OK.
Why? Root Hints are used to contact other root servers. But since we are configuring this server as the root server, we remove them.
Step 5: Add Records to the Root Zone
Expand the Forward Lookup Zones and select the newly created . zone.
Right-click in the zone and select New Host (A).
Leave the Name field blank (for root).
Enter the IP address of the DNS server itself (e.g., 192.168.1.1).
Click Add Host and then Done.
Step 6: Restart the DNS Server
In the DNS Manager, right-click the server name.
Click Stop and then Start to restart the DNS service.
Your Windows 2000 Server is now configured as a Root Name Server, and it will respond authoritatively to root (.) queries, without relying on external root hints.