Question
When system administrators want to set a users password in the non-interactive mode (meaning without the need of entering the username and password manually), then
When system administrators want to set a users password in the non-interactive mode (meaning without the need of entering the username and password manually), then instead of using the passwd command the chpasswd command is used. This command reads user:password pair(s) from a data file instead of waiting for system administrators to manually enter them which results in automating the whole process. The condition for the chpasswd command to run properly is the correct syntax of the data file. Your script is supposed to create such a data file based on a text file containing list of those students for whom the password needs to be changed provided in the following format:
1. FirstName1 Surname1 Date_of_Birth_As_DD.MM.YYYY
2. FirstName2 Syrname2 Date_of_Birth_As_DD.MM.YYYY
Example file containing the list of students may look like below:
1. Jan Kowalski 01.01.2002
2. Max Nowak 11.12.1997
The way the user:password pair(s) should be automatically created based on the students list file is the following:
username should consist of 3 first characters from: the Name field and 3 first characters from the Surname field followed by YYMMYY where the YY should be the last two characters of the year of birth. For the example data file the output file should be: jankow010102:password maxnow111297:password password, it should be created in the following form: !1_username So, the final form of the data file should be: jankow010102:!1_jankow010102 pawnow111297:!1_maxnow111297 Your script should take 2 command line parameters: Filename containing the list of students Output data file name in which the user:password pair(s) will be stored. So, in the AMS system your script will be executed as ./scriptname student_list data_file and it should produce in the same folder in which the file with students list is located a filename given by the second command line parameter. How to test your script before checking with AMS: 1. Create a text file containing any list (e.g. students.txt) of students in the format explained above. 2. Execute your script as for example: ./scriptname students.txt passwords.txt 3 3. Check if the created passwords.txt file containing the user:password pair(s) has the right format (as described above). 4. Change some of the students data in the students.txt and run your script again as in step 2. 5. Check again if the created passwords.txt file containing the user:password pair(s) has the right format (reflecting the changes you made to the students.txt file. 6. Now, in case your tests went smoothly, you are ready to check your script in AMS. If otherwise, make corrections to your script and start over from step 1.
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