Skip to content

Commit

Permalink
Update: Adding delete an user
Browse files Browse the repository at this point in the history
1 - Adding delete user ability
2 - update read me file
  • Loading branch information
llaravell committed May 12, 2024
1 parent 8b416da commit cc71d07
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions mahimana.sh
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,16 @@ changePassword() {
main;
}

# Delete User
deleteUser() {
read -p "Enter the username: " username
printf "${Blue} 🚀 Deleting user ... ${NC} \n";
userdel -r $username > /dev/null 2>&1 & spinner;
printf "${Green} 🎉 User is deleted sucessfully ${NC} \n";
sleep 5;
main;
}

# Main
main() {
clear
Expand All @@ -703,6 +713,7 @@ main() {
printf "${Cyan}15. Close port Firewall${NC}\n"
printf "${Cyan}16. Add new OS user${NC}\n"
printf "${Cyan}17. Change Password for OS user${NC}\n"
printf "${Cyan}18. Delete OS user${NC}\n"

read -p "Enter your choice: " choice

Expand Down Expand Up @@ -758,6 +769,9 @@ main() {
17)
changePassword
;;
18)
deleteUser
;;
*)
printf "${Red}Invalid choice. Exiting.${NC}\n"
exit 1
Expand Down
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Here're some of the project's best features:
* Close a port <span style="color:red">firewall</span>
* Add new OS user
* Change password for users
* Delete an user

<h2>🛠️ Usage</h2>

Expand Down

0 comments on commit cc71d07

Please sign in to comment.