Introduction
In this project, you will learn how to create and manage user accounts for teachers and students in a classroom server environment. You will use a bash script called userctr.sh
to automate the process of adding and deleting user accounts, which can be a tedious task when done manually.
👀 Preview
## Add 1 teacher user and 6 student users (stu1 to stu6)
$ sh userctr.sh add teacher stu 6
teacher:617533
stu1:345893
stu2:183263
stu3:404525
stu4:571165
stu5:251940
stu6:716130
## Delete 1 teacher user and 6 student users (stu1 to stu6)
$ sh userctr.sh del teacher stu 6
🎯 Tasks
In this project, you will learn:
- How to set up the necessary environment for the project
- How to implement functions to add and delete users and groups
- How to test the
userctr.sh
script to ensure it works as expected
🏆 Achievements
After completing this project, you will be able to:
- Understand the importance of automating user management tasks
- Create and manage user accounts for teachers and students using a bash script
- Ensure that user accounts are created with the appropriate settings, such as default shell and sudo privileges
- Efficiently add and delete user accounts in a classroom server environment
Skills Graph
%%%%{init: {'theme':'neutral'}}%%%%
flowchart RL
shell(("`Shell`")) -.-> shell/ControlFlowGroup(["`Control Flow`"])
linux(("`Linux`")) -.-> linux/BasicSystemCommandsGroup(["`Basic System Commands`"])
linux(("`Linux`")) -.-> linux/InputandOutputRedirectionGroup(["`Input and Output Redirection`"])
linux(("`Linux`")) -.-> linux/UserandGroupManagementGroup(["`User and Group Management`"])
shell(("`Shell`")) -.-> shell/BasicSyntaxandStructureGroup(["`Basic Syntax and Structure`"])
shell(("`Shell`")) -.-> shell/VariableHandlingGroup(["`Variable Handling`"])
shell(("`Shell`")) -.-> shell/AdvancedScriptingConceptsGroup(["`Advanced Scripting Concepts`"])
shell(("`Shell`")) -.-> shell/SystemInteractionandConfigurationGroup(["`System Interaction and Configuration`"])
linux(("`Linux`")) -.-> linux/FileandDirectoryManagementGroup(["`File and Directory Management`"])
shell/ControlFlowGroup -.-> shell/if_else("`If-Else Statements`")
linux/BasicSystemCommandsGroup -.-> linux/exit("`Shell Exiting`")
linux/BasicSystemCommandsGroup -.-> linux/echo("`Text Display`")
linux/InputandOutputRedirectionGroup -.-> linux/pipeline("`Data Piping`")
linux/InputandOutputRedirectionGroup -.-> linux/redirect("`I/O Redirecting`")
linux/BasicSystemCommandsGroup -.-> linux/test("`Condition Testing`")
linux/UserandGroupManagementGroup -.-> linux/id("`User/Group ID Displaying`")
linux/UserandGroupManagementGroup -.-> linux/useradd("`User Adding`")
linux/UserandGroupManagementGroup -.-> linux/userdel("`User Removing`")
linux/UserandGroupManagementGroup -.-> linux/usermod("`User Modifying`")
linux/UserandGroupManagementGroup -.-> linux/sudo("`Privilege Granting`")
shell/BasicSyntaxandStructureGroup -.-> shell/shebang("`Shebang`")
shell/BasicSyntaxandStructureGroup -.-> shell/comments("`Comments`")
shell/BasicSyntaxandStructureGroup -.-> shell/quoting("`Quoting Mechanisms`")
shell/VariableHandlingGroup -.-> shell/variables_decl("`Variable Declaration`")
shell/VariableHandlingGroup -.-> shell/variables_usage("`Variable Usage`")
shell/ControlFlowGroup -.-> shell/for_loops("`For Loops`")
shell/ControlFlowGroup -.-> shell/cond_expr("`Conditional Expressions`")
shell/ControlFlowGroup -.-> shell/exit_status("`Exit and Return Status`")
shell/AdvancedScriptingConceptsGroup -.-> shell/arith_ops("`Arithmetic Operations`")
shell/AdvancedScriptingConceptsGroup -.-> shell/arith_expansion("`Arithmetic Expansion`")
shell/AdvancedScriptingConceptsGroup -.-> shell/cmd_substitution("`Command Substitution`")
shell/AdvancedScriptingConceptsGroup -.-> shell/subshells("`Subshells and Command Groups`")
shell/AdvancedScriptingConceptsGroup -.-> shell/adv_redirection("`Advanced Redirection`")
shell/SystemInteractionandConfigurationGroup -.-> shell/globbing_expansion("`Globbing and Pathname Expansion`")
linux/FileandDirectoryManagementGroup -.-> linux/wildcard("`Wildcard Character`")
subgraph Lab Skills
shell/if_else -.-> lab-301459{{"`Users and Groups Creation and Deletion Batch`"}}
linux/exit -.-> lab-301459{{"`Users and Groups Creation and Deletion Batch`"}}
linux/echo -.-> lab-301459{{"`Users and Groups Creation and Deletion Batch`"}}
linux/pipeline -.-> lab-301459{{"`Users and Groups Creation and Deletion Batch`"}}
linux/redirect -.-> lab-301459{{"`Users and Groups Creation and Deletion Batch`"}}
linux/test -.-> lab-301459{{"`Users and Groups Creation and Deletion Batch`"}}
linux/id -.-> lab-301459{{"`Users and Groups Creation and Deletion Batch`"}}
linux/useradd -.-> lab-301459{{"`Users and Groups Creation and Deletion Batch`"}}
linux/userdel -.-> lab-301459{{"`Users and Groups Creation and Deletion Batch`"}}
linux/usermod -.-> lab-301459{{"`Users and Groups Creation and Deletion Batch`"}}
linux/sudo -.-> lab-301459{{"`Users and Groups Creation and Deletion Batch`"}}
shell/shebang -.-> lab-301459{{"`Users and Groups Creation and Deletion Batch`"}}
shell/comments -.-> lab-301459{{"`Users and Groups Creation and Deletion Batch`"}}
shell/quoting -.-> lab-301459{{"`Users and Groups Creation and Deletion Batch`"}}
shell/variables_decl -.-> lab-301459{{"`Users and Groups Creation and Deletion Batch`"}}
shell/variables_usage -.-> lab-301459{{"`Users and Groups Creation and Deletion Batch`"}}
shell/for_loops -.-> lab-301459{{"`Users and Groups Creation and Deletion Batch`"}}
shell/cond_expr -.-> lab-301459{{"`Users and Groups Creation and Deletion Batch`"}}
shell/exit_status -.-> lab-301459{{"`Users and Groups Creation and Deletion Batch`"}}
shell/arith_ops -.-> lab-301459{{"`Users and Groups Creation and Deletion Batch`"}}
shell/arith_expansion -.-> lab-301459{{"`Users and Groups Creation and Deletion Batch`"}}
shell/cmd_substitution -.-> lab-301459{{"`Users and Groups Creation and Deletion Batch`"}}
shell/subshells -.-> lab-301459{{"`Users and Groups Creation and Deletion Batch`"}}
shell/adv_redirection -.-> lab-301459{{"`Users and Groups Creation and Deletion Batch`"}}
shell/globbing_expansion -.-> lab-301459{{"`Users and Groups Creation and Deletion Batch`"}}
linux/wildcard -.-> lab-301459{{"`Users and Groups Creation and Deletion Batch`"}}
end