A Bash script for managing users and groups in Linux systems with an interactive menu interface. This script provides a simple and safe way to perform common user management tasks such as creating/deleting users and groups.
- Create new users with customizable options
- Delete existing users and their home directories
- Create new groups
- Delete existing groups
- Interactive menu interface
- Built-in security checks
- Sudo privileges management
- Custom group assignment options
- Linux operating system
- Root privileges (sudo access)
- Bash shell
- Download the script:
wget https://raw.githubusercontent.com/kfiramar/manage_linux_users/main/user_management.sh- Make the script executable:
chmod +x user_management.shRun the script with sudo privileges:
sudo ./user_management.sh-
Create a new user
- Prompts for username
- Creates user with home directory
- Sets user password
- Option to add sudo privileges
- Alternative group assignment
-
Delete a user
- Prompts for username
- Confirmation required
- Removes user and home directory
-
Create a group
- Prompts for group name
- Checks for existing groups
-
Delete a group
- Prompts for group name
- Confirmation required
- Removes group from system
-
Exit
- Safely exits the script
- Root privilege verification
- Existence checks for users and groups
- Confirmation prompts for destructive actions
- Error handling for all operations
- Safe password setting process
The script includes comprehensive error handling for:
- Failed user creation
- Failed password setting
- Failed group operations
- Invalid inputs
- Insufficient privileges
$ sudo ./user_management.sh
1 # Select option 1
john # Enter username
Password123 # Enter password
y # Add sudo privileges$ sudo ./user_management.sh
1 # Select option 1
jane # Enter username
Password456 # Enter password
n # Don't add sudo privileges
users # Add to regular users group- Only works on Linux systems with standard user management commands
- Requires root privileges
- Does not support batch operations
- Limited to basic user/group management tasks
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request
This script is released under the MIT License. See the LICENSE file for details.
Kfir Amar kfira2002@gmail.com
- 1.0.0 (2024-11-25)
- Initial release
- Basic user and group management features
- Interactive menu interface
- Inspired by Linux system administration best practices
- Thanks to the Linux user management community
For support, please open an issue in the GitHub repository or contact the author directly.
When using this script:
- Always backup important system files before making user management changes
- Use strong passwords for new users
- Be cautious when deleting users and groups
- Keep track of sudo privilege assignments
- Regularly audit user and group assignments