This repository contains scripts for migrating users from Nextcloud to Authentik IDM.
-
Export users from Nextcloud: Run the
nextcloud_user_export.shscript. This script uses the Nextcloudocccommand to fetch user information and exports it to a JSON file (nextcloud_user_info.json)../nextcloud_user_export.sh
Make sure to run this script on the server where Nextcloud is installed and that the user running the script has the necessary permissions to execute the
occcommand. -
Import users to Authentik: Run the
authentik_user_import.pyscript. This script reads the user data fromnextcloud_user_info.json, fetches existing groups from Authentik, and imports the users into Authentik.python3 authentik_user_import.py
Before running the script, make sure to set the Authentik API credentials and endpoints at the top of the script:
authentik_url = '' # Authentik URL authentik_api_key = '' # Authentik API key authentik_username = '' # Authentik username
-
authentik_user_import.pyrequires Python 3 and therequestslibrary. You can installrequestsusing pip:pip install requests
-
nextcloud_user_export.shrequiresjqfor processing JSON data. You can installjqusing the package manager for your system (e.g.,apt,yum,brew).
These scripts are intended for use with the Authentik Identity Provider and Nextcloud. Please ensure you have the necessary permissions and access to the Authentik API and Nextcloud occ command before running these scripts.