Question
A company has set up a new site and transfer staff and visitor accounts to the new site. Your task is to write a Bash
A company has set up a new site and transfer staff and visitor accounts to the new site. Your task is to write a Bash script to create user accounts for all staff and visitors. The supplied user file Usernames.txt is a text file containing a username and its type delimited by comma per line. There are two types of users: staff and visitor. Staff users are added to the staff group and visitor users to the visitors group.
1. Write a Bash script, called createUsers.sh, to do the followings. a) Create two groups called visitors and staff; b) Create an account for each user and add the user to its group in one command. All user accounts are created with an initial password the same as their username; a home directory with the same name as their username in the /home directory; all accounts use Bash shell program. c) Write messages to syslog for all of the above events (new group, new user creation). Note that while the current need is to handle limited number of usernames from the given user file, your script should be able to handle an arbitrary number of usernames. (4 marks)
2. Write a Bash script, called reportVisitors.sh, to report the members of visitors group to the file /tmp/visitors.txt. The output should contain the user names only with each user in a separate line. (1 mark)
3. Create a crontab entry to call the reportVisitors.sh script at 8:00AM and 9:00PM on every weekdays. (1 mark)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started