Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using bash, please help me get this done in the easiest way possible with output please. CIS 345 1. Homework problem set #3 Write an

Using bash, please help me get this done in the easiest way possible with output please.

image text in transcribed

CIS 345 1. Homework problem set #3 Write an interactive script called adduser. Your script should gather all the pertinent information such as user name, group, shell, etc., error check input, then call useradd with the appropriate options and arguments. You will also need to call chfn and passwd for the new user account. You should offer the option of choosing a primary group different from the default, choosing additional groups the new user should be a member of selecting a home directory different from the default, choosing a shell different from the default, and anything else you think appropriate for your system. Your script must call the useradd command. Your script's error checking should be comprehensive enough so that when you call useradd it will not generate any error messages 20 points 2. Removing a user can be more difficult than creating one. The userdel command will remove a user and his/her home directory but it will not clean up any files owned by that user in other parts of the system. What if the user you are trying to delete is logged on? Write your own script to delete a user. It should be similar to your adduser script in that it is a front end for the userdel command. It should also search the system for any files owned by the user being deleted and remove them. You need only search directories where users might leave things. If they are logged on your script should be able to deal with it. Dealing with that issue does not mean printing an error message and terminating your script. 10 points 3. Write a shell script called watchdog that you can run in the background that will periodically check to see if a user listed in your friends file in your home directory is logged on. This script should run until one of your "friends logs on. When one of your friends logs on, say bob, your program should issue an alert and print a message like !!!!! Bob is logged on! For example. This message should appear in the center of a blank terminal. Your script should not stop running after it finds one of your friends has logged on. However, it should not keep reporting the fact that your friend is logged on. It should report if another of your friends logs on. But each logon should be reported only once. When one of you're logged on friends logs off that should be reported as well. A friend who logs on and then logs off and then logs on again should have all three occurrences reported. The process will continue to run in the background. You will have to make your own friends file. The format is just a list of login names. HINT: You might want to maintain two lists in your program. One for those you are watching for who have not logged on and one for those who are logged on that you are waiting to log off. This is a very practical problem if you have some known troublemakers on your system that you are trying to keep tabs on. You can have your alert message also append to a file. That will give you a record of your friend's activity. Make sure your script is well documented and clearly explains how it works. 10 points DUE 3-19-21

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Visual C# And Databases

Authors: Philip Conrod, Lou Tylee

16th Edition

1951077083, 978-1951077082

More Books

Students also viewed these Databases questions