| Solution |
The debug will display the following message when the administrator is trying to export remote LDAP users, getting '500 Internal Server Error' while exporting the remote user, and getting the following logs.
2025-11-07T16:26:19.237572-08:00 FortiAuthenticator gui[1536] error fac.home.www-data.fac.fac.apps.remote_user.admin __init__ 139785200957120 Failed to export remote LDAP users: ERROR: could not open file "/var/tmp/ldapusers.csv" for writing: Permission denied HINT: COPY TO instructs the PostgreSQL server process to write a file. You may want a client-side facility such as psql's \copy. 2025-11-08 00:26:19,370 error django.request log 1536 139785200957120 Internal Server Error: /admin/remote_user/remoteldapuser/export/ Traceback (most recent call last): File "/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner response = get_response(request) ^^^^^^^^^^^^^^^^^^^^^ File "/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/lib/python3.11/site-packages/django/utils/decorators.py", line 134, in _wrapper_view response = view_func(request, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/lib/python3.11/site-packages/django/views/decorators/cache.py", line 62, in _wrapper_view_func response = view_func(request, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/lib/python3.11/site-packages/django/contrib/admin/sites.py", line 242, in inner return view(request, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/lib/python3.11/site-packages/django/utils/decorators.py", line 46, in _wrapper return bound_method(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "./fac/fac/apps/fac_auth/decorators.py", line 38, in _check_perm File "./fac/fac/apps/remote_user/admin.py", line 505, in ldap_user_export_view File "./fac/fac/utils/process.py", line 66, in fork_process RuntimeError: ERROR: could not open file "/var/tmp/ldapusers.csv" for writing: Permission denied HINT: COPY TO instructs the PostgreSQL server process to write a file. You may want a client-side facility such as psql's \copy.
Sometimes the error could be displayed like the following example:
2025-12-02 12:54:47,720 error django.request log 8299 140393255442112 Internal Server Error: /admin/remote_user/remoteldapuser/export/ RuntimeError: ERROR: could not open file "/var/tmp/ldapusers.csv" for writing: Permission denied
This behavior is recorded on Bug ID:1224722.
To fix this issue, upgrade FortiAuthenticator to v6.6.8 or v8.0.1.
|