Using the attached file as a "database" of users, develop an application that reads the users.txt file, and adds each one as a new user. Eac
Using the attached file as a "database" of users, develop an application that reads the users.txt file, and adds each one as a new user. Each user must also have a password, though in the interest of brevity, they may all be assigned the same one. Provide me the source code and a copy of your system's /etc/passwd file.
accounts.txt includes 1. Pittman,Mckenzie,Sales 2. Donovan,Moriah,Accounting 3. Barnes,Gabriel,Sales 4. Monroe,Maximillian,Management 5. Maynard,Sylvia,Management 6. Mayer,Elise,Accounting 7. Reeves,Stephen,Production 8. Oneill,Sean,Sales 9. Jackson,Hanna,Management 10. Lee,Alani,Production 11. Golden,Ibrahim,Production 12. Tyrese,Todd,Production Note: it is perfectly acceptable to "leverage" code from another source provided: 1) you understand what the example code is doing, and 2) you write it yourself. Remember to give attribution to any code you use that you didn't write. |
Quote:
Read the LQ Rules about such things. Post reported. |
|
Quote:
On RHEL/Centos, there is a newusers command, which may simplify the task (or not). Not sure if other distros have it. |
Quote:
Code:
while IFS=${IFS/#/,} read anumber surname forename department if so, tag ${surname:0:1} on the end but it could be done without grep upper lower case may need to be accounted for , I seem to remember having to patch things to get uppercase support, but that was years ago. |
Quote:
HA HA. At no cost, should the OP should send it. A before and after wc -l for /etc/passwd should do to show that entries have been added.. Generally, don't send /etc/passwd and /etc/shadow under any condition. They contain the hashed password and other details of the user. OK |
Quote:
better to grep ^username: /etc/passwd and grep -c . /etc/passwd is better than wc -l no need to mess about with cut Edit: had a thought wc -l </etc/passwd also means you don't have to use cut but I also wondered why you wouldn't trust the exit status of useradd |
Quote:
|
Quote:
|
To be clear: does the instructor just want these entries added to /etc/passwd?
|
Quote:
Many LQ members are very much capable of completing this type of homework assignment, however it is your assignment and your fellow LQ members, who are all volunteers are not here to provide "on demand" answers. Please show some effort, or at least web search for some of these answers. |
Quote:
What have you done/tried/researched in order to do this? Because as of now, you posted your homework question, and seem to be expecting us to just answer it for you. |
Quote:
|
Quote:
I will also point out that windows XP is a poor choice of platform to be finger wagging over security issues from. |
All times are GMT -5. The time now is 09:43 AM. |