A Bash script to automate user and group synchronization with a TrueNAS server via API.
- Fetches non-builtin users and groups from TrueNAS.
- Saves them to CSV files for reference.
- Creates users and groups on the TrueNAS server.
- Ensures group IDs are correctly assigned.
- TrueNAS API access
curl
andjq
installed on the system- Midclt (
midclt call
) for group and user creation
-
Clone the repository:
git clone https://github.com/ShipwreckIII/TrueNAS_GroupManager.git cd TrueNAS_GroupManager
-
Run the script:
chmod +x user_sync_tool.sh ./user_sync_tool.sh
-
Enter the required details when prompted: TrueNAS server IP Username and Password
-
The script will: Fetch existing groups and users. Save them in groups_.csv and users_.csv. Prompt before creating new users and groups.
-
Notes The script uses API authentication, so ensure proper access rights. User passwords are set using their UID (modify as needed). Group IDs must be fetched correctly before creating users.
-
License MIT License
Eng.Ahmad abd Al-Hadi
Let me know if you need changes