Question: Create a Linux shell script to automate adding new users from a file. CSV FILE: 1. Generate 1,000 user records having the following fields/columns: user_id,
Create a Linux shell script to automate adding new users from a file.
CSV FILE: 1. Generate 1,000 user records having the following fields/columns: user_id, username, password e.g.
NOTE: save the file as users.csv 2. Generate 5 group records having the following fields/columns: groupid, groupname e.g.
NOTE: save the file as groups.csv ***Use command prompt (SCP) to transfer the csv files from Windows to your Ubuntu Server. Syntax: SCP file_path root@ipaddress:/path e.g. SCP D:/1234567/files.csv superman@192.168.55.5:/home/superman/activity4 3. Create a shell script called groups.sh that creates user groups based from the csv file (groups.csv). 4. Create a shell script called accounts.sh that performs the following:
Create user accounts for each of the users in the users.csv file Create home directories for each user Only the owner can read, write and execute on their respective home directories Assign each user to their respective groups NOTE: groupA: UID (User ID) range 5000 - 5250 groupB: UID (User ID) range 5251 - 5500 groupC: UID (User ID) range 5501 - 5750 groupD: UID (User ID) range 5751 - 6000 groupE: UID (User ID) 6001 and above
5. Create a shell script called run.sh that will execute groups.sh and accounts.sh respectively.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
