CIS 4343 Applied Net-Centric Computing
Homework 02 – Linux Networking (20 points)
Name: ___________________
Assigned: 2/15/Wednesday,
Demo Due Date: 2/27 (between 1:00pm-1:45pm)
Preparation/Pre-caution work:
Please feel free to visit http://www.server-world.info/en/ or http://www.linuxhomenetworking.com/ to learn more
about the basic/advanced networking topics, if you want to.
You are not required to use a static IP or a cross-over Ethernet cable for this homework.
The working time listed after some of questions is just a reference. Please work on it based on your own pace.
This is not a group project so you are required to do your own work.
Why do we have to do homework? “Tell me and I forget. Show me and I remember. Involve me and I understand.” –
Chinese proverb.
Pre-requirement:
o Try the following steps to install the gcc(ie., c++) compiler
o yum update audit
o yum –y install gcc gcc-c++
o //To compile: g++ filename.cpp or g++ filename.cpp -o filename.exe
o //To execute: ./a.out or ./filename.exe
1. Write an add/delete users utility program to add or delete some new/old user accounts on your Linux
system. [20%]
Requirements:
a. Process the first 100 user records from an input file “userNames1000.txt” (in the homework folder).
Each record/line has the format of username:id (e.g., Jacob:20153).
b. For each user account/credential, your program will:
use the “username” (e.g., Jacob, Mason, …) in the file as his/her account user name
use “se-id” as his/her account password (e.g., se-20153, se-19396, se-17151, se-16861, …). That
is prefix the “se-“ before the id to create the password.
c. It is up to you to create one program (e.g., addDeleteUsers.cpp) or two programs (addUsers.cpp and
deleteUsers.cpp) for this exercise.
d. When your program delete a user, the program will delete the user’s account and all his/her
directory/subdirectories/files from the system as well. [3%]
e. Submit all your source code files in one zip file to the blackboard system. [3%]
References/hints:
a. Feel free to use the addDeleteUserSample.cpp.txt as a template
b. Check out the function strtok http://www.cplusplus.com/reference/cstring/strtok/
c. Refer to Strings and String Manipulation in C++, https://cal-linux.com/tutorials/strings.html
d. Feel free to use Linux’s free utility program to compress/zip files
Learn how to test:
Show me/yourself the process of adding the 100 users to your system.
o Then select a user randomly and use the user’s credential (username and password, e.g., Lucas,
se-10324) to login into his/her account.
o or use the “Users and Groups” GUI to verify the result after adding the users, if necessary.
Show me the process of deleting the 100 users.
o change to /home and use ls to check the user directories.
o or use the “Users and Groups” GUI to verify the result after deleting the users, if necessary