JupyterHub Ldap Authentication Issue

Hi,

I have an authentication problem when logging in. It gives an error as wrong username or password in the interface. When I look at the Jupyterhub log, I see the error No entry found for user ‘furkan.gayir’ when looking up attribute ‘sAMAccountName’. I share the configuration below. I would appreciate if you can support.

c.JupyterHub.authenticator_class = ‘ldapauthenticator.LDAPAuthenticator’
c.LDAPAuthenticator.server_address = “ldapserver”
c.LDAPAuthenticator.server_port = 389
c.LDAPAuthenticator.allowed_groups = [“ldapgroup”]
c.LDAPAuthenticator.lookup_dn = True
c.LDAPAuthenticator.lookup_dn_search_filter = ‘(&(objectClass=user)(sAMAccountName={username}))’
c.LDAPAuthenticator.lookup_dn_search_user = ‘ldapuser’
c.LDAPAuthenticator.lookup_dn_search_password = ‘ldappasswd’
c.LDAPAuthenticator.user_search_base = ‘ldapbase’
c.LDAPAuthenticator.user_attribute = ‘sAMAccountName’
c.LDAPAuthenticator.lookup_dn_user_dn_attribute = ‘cn’
c.LDAPAuthenticator.use_ssl = False

Thanks

Can you ensure you’re using the latest releases of LDAPAuthenticator and JupyterHub, turn on JupyterHub debug logging, and show us your full logs?

When I changed c.LDAPAuthenticator.lookup_dn_user_dn_attribute = ‘sAMAccountName’ and c.LDAPAuthenticator.lookup_dn_search_filter = ‘(sAMAccountName={login})’ i was able to overcome the problem I mentioned but a different error appeared. I installed the Ldapauthenticator package with conda without specifying any version. It automatically installed version 1.3.2.

Oct 31 10:43:25 pe-jupytr-pl1 jupyterhub[1872071]: [I 2024-10-31 07:43:25.231 JupyterHub base:837] User logged in: furkan.gayir
Oct 31 10:43:25 pe-jupytr-pl1 jupyterhub[1872071]: [I 2024-10-31 07:43:25.233 JupyterHub log:191] 302 POST /hub/login?next=%2Fhub%2F → /hub/ (furkan.gayir@::ffff:172.24.5.99) 890.73ms
Oct 31 10:43:25 pe-jupytr-pl1 jupyterhub[1872071]: [I 2024-10-31 07:43:25.288 JupyterHub log:191] 302 GET /hub/ → /hub/spawn (furkan.gayir@::ffff:172.24.5.99) 9.96ms
Oct 31 10:43:25 pe-jupytr-pl1 jupyterhub[1872071]: [I 2024-10-31 07:43:25.351 JupyterHub provider:659] Creating oauth client jupyterhub-user-furkan.gayir
Oct 31 10:43:25 pe-jupytr-pl1 jupyterhub[1872071]: [I 2024-10-31 07:43:25.362 JupyterHub spawner:1689] Spawning jupyterhub-singleuser
Oct 31 10:43:25 pe-jupytr-pl1 jupyterhub[1872071]: [E 2024-10-31 07:43:25.376 JupyterHub user:884] Unhandled error starting furkan.gayir’s server: Exception occurred in preexec_fn.
Oct 31 10:43:25 pe-jupytr-pl1 jupyterhub[1872071]: Traceback (most recent call last):
Oct 31 10:43:25 pe-jupytr-pl1 jupyterhub[1872071]: File “/data1/conda/lib/python3.11/site-packages/jupyterhub/user.py”, line 798, in spawn
Oct 31 10:43:25 pe-jupytr-pl1 jupyterhub[1872071]: url = await gen.with_timeout(timedelta(seconds=spawner.start_timeout), f)
Oct 31 10:43:25 pe-jupytr-pl1 jupyterhub[1872071]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 31 10:43:25 pe-jupytr-pl1 jupyterhub[1872071]: File “/data1/conda/lib/python3.11/site-packages/jupyterhub/spawner.py”, line 1699, in start
Oct 31 10:43:25 pe-jupytr-pl1 jupyterhub[1872071]: self.proc = Popen(cmd, **popen_kwargs)
Oct 31 10:43:25 pe-jupytr-pl1 jupyterhub[1872071]: ^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 31 10:43:25 pe-jupytr-pl1 jupyterhub[1872071]: File “/data1/conda/lib/python3.11/subprocess.py”, line 1026, in init
Oct 31 10:43:25 pe-jupytr-pl1 jupyterhub[1872071]: self._execute_child(args, executable, preexec_fn, close_fds,
Oct 31 10:43:25 pe-jupytr-pl1 jupyterhub[1872071]: File “/data1/conda/lib/python3.11/subprocess.py”, line 1951, in _execute_child
Oct 31 10:43:25 pe-jupytr-pl1 jupyterhub[1872071]: raise child_exception_type(err_msg)
Oct 31 10:43:25 pe-jupytr-pl1 jupyterhub[1872071]: subprocess.SubprocessError: Exception occurred in preexec_fn.
Oct 31 10:43:25 pe-jupytr-pl1 jupyterhub[1872071]:
Oct 31 10:43:25 pe-jupytr-pl1 jupyterhub[1872071]: [E 2024-10-31 07:43:25.399 JupyterHub pages:313] Error starting server furkan.gayir: Exception occurred in preexec_fn.
Oct 31 10:43:25 pe-jupytr-pl1 jupyterhub[1872071]: Traceback (most recent call last):
Oct 31 10:43:25 pe-jupytr-pl1 jupyterhub[1872071]: NoneType: None
Oct 31 10:43:25 pe-jupytr-pl1 jupyterhub[1872071]:
Oct 31 10:43:25 pe-jupytr-pl1 jupyterhub[1872071]: [W 2024-10-31 07:43:25.399 JupyterHub web:1869] 500 GET /hub/spawn (::ffff:172.24.5.99): Unhandled error starting server furkan.gayir

Can you share your full JupyterHub config, turn on debug logging, and show us the full logs?

Jupyterhub logs: Nov 01 14:01:13 pe-jupytr-pl1 jupyterhub[1872093]: 11:01:13.742 [ConfigProxy] info: 200 GET /api/routes
Nov 01 14:06:13 pe-jupytr-pl1 jupyterhub[1872093]: 11:06:13.743 [ConfigProxy] info: 200 GET /api/routes
Nov 01 14:11:13 pe-jupytr-pl1 jupyterhub[1872093]: 11:11:13.746 [ConfigProxy] info: 200 GET /api/routes
Nov 01 14:16:13 pe-jupytr-pl1 jupyterhub[1872093]: 11:16:13.743 [ConfigProxy] info: 200 GET /api/routes
Nov 01 14:21:13 pe-jupytr-pl1 jupyterhub[1872093]: 11:21:13.742 [ConfigProxy] info: 200 GET /api/routes
Nov 01 14:26:13 pe-jupytr-pl1 jupyterhub[1872093]: 11:26:13.743 [ConfigProxy] info: 200 GET /api/routes
Nov 01 14:31:13 pe-jupytr-pl1 jupyterhub[1872093]: 11:31:13.742 [ConfigProxy] info: 200 GET /api/routes
Nov 01 14:36:13 pe-jupytr-pl1 jupyterhub[1872093]: 11:36:13.743 [ConfigProxy] info: 200 GET /api/routes
Nov 01 14:40:15 pe-jupytr-pl1 jupyterhub[1872071]: [I 2024-11-01 11:40:15.607 JupyterHub metrics:278] Found 0 active users in the last ActiveUserPeriods.twenty_four_hours
Nov 01 14:40:15 pe-jupytr-pl1 jupyterhub[1872071]: [I 2024-11-01 11:40:15.608 JupyterHub metrics:278] Found 3 active users in the last ActiveUserPeriods.seven_days
Nov 01 14:40:15 pe-jupytr-pl1 jupyterhub[1872071]: [I 2024-11-01 11:40:15.610 JupyterHub metrics:278] Found 3 active users in the last ActiveUserPeriods.thirty_days
Nov 01 14:41:13 pe-jupytr-pl1 jupyterhub[1872093]: 11:41:13.743 [ConfigProxy] info: 200 GET /api/routes
Nov 01 14:46:13 pe-jupytr-pl1 jupyterhub[1872093]: 11:46:13.743 [ConfigProxy] info: 200 GET /api/routes
Nov 01 14:51:13 pe-jupytr-pl1 jupyterhub[1872093]: 11:51:13.741 [ConfigProxy] info: 200 GET /api/routes
Nov 01 14:56:13 pe-jupytr-pl1 jupyterhub[1872093]: 11:56:13.743 [ConfigProxy] info: 200 GET /api/routes
Nov 01 15:01:13 pe-jupytr-pl1 jupyterhub[1872093]: 12:01:13.742 [ConfigProxy] info: 200 GET /api/routes
Nov 01 15:06:13 pe-jupytr-pl1 jupyterhub[1872093]: 12:06:13.742 [ConfigProxy] info: 200 GET /api/routes
Nov 01 15:06:26 pe-jupytr-pl1 systemd[1]: Stopping Jupyter Notebook…
Nov 01 15:06:26 pe-jupytr-pl1 jupyterhub[1872071]: [C 2024-11-01 12:06:26.075 JupyterHub app:3336] Received signal SIGTERM, initiating shutdown…
Nov 01 15:06:26 pe-jupytr-pl1 jupyterhub[1872071]: [I 2024-11-01 12:06:26.075 JupyterHub app:2981] Cleaning up single-user servers…
Nov 01 15:06:26 pe-jupytr-pl1 jupyterhub[1872071]: [I 2024-11-01 12:06:26.075 JupyterHub proxy:820] Cleaning up proxy[1872093]…
Nov 01 15:06:26 pe-jupytr-pl1 jupyterhub[1872093]: 12:06:26.075 [ConfigProxy] warn: Terminated
Nov 01 15:06:26 pe-jupytr-pl1 jupyterhub[1872071]: [I 2024-11-01 12:06:26.076 JupyterHub app:3013] …done
Nov 01 15:06:26 pe-jupytr-pl1 systemd[1]: jupyter.service: Deactivated successfully.
Nov 01 15:06:26 pe-jupytr-pl1 systemd[1]: Stopped Jupyter Notebook.
Nov 01 15:06:26 pe-jupytr-pl1 systemd[1]: jupyter.service: Consumed 52.271s CPU time.
Nov 01 15:06:29 pe-jupytr-pl1 systemd[1]: Started Jupyter Notebook.
Nov 01 15:06:37 pe-jupytr-pl1 jupyterhub[87737]: [I 2024-11-01 12:06:37.095 JupyterHub app:2859] Running JupyterHub version 4.0.2
Nov 01 15:06:37 pe-jupytr-pl1 jupyterhub[87737]: [I 2024-11-01 12:06:37.096 JupyterHub app:2889] Using Authenticator: ldapauthenticator.ldapauthenticator.LDAPAuthenticator-1.3.2
Nov 01 15:06:37 pe-jupytr-pl1 jupyterhub[87737]: [I 2024-11-01 12:06:37.096 JupyterHub app:2889] Using Spawner: jupyterhub.spawner.LocalProcessSpawner-4.0.2
Nov 01 15:06:37 pe-jupytr-pl1 jupyterhub[87737]: [I 2024-11-01 12:06:37.096 JupyterHub app:2889] Using Proxy: jupyterhub.proxy.ConfigurableHTTPProxy-4.0.2
Nov 01 15:06:37 pe-jupytr-pl1 jupyterhub[87737]: [I 2024-11-01 12:06:37.144 JupyterHub app:1664] Loading cookie_secret from /tmp/jupyterhub_cookie_secret
Nov 01 15:06:37 pe-jupytr-pl1 jupyterhub[87737]: [D 2024-11-01 12:06:37.148 JupyterHub app:1833] Connecting to db: sqlite:///jupyterhub.sqlite
Nov 01 15:06:37 pe-jupytr-pl1 jupyterhub[87737]: [D 2024-11-01 12:06:37.371 JupyterHub orm:1016] database schema version found: 0eee8c825d24
Nov 01 15:06:37 pe-jupytr-pl1 jupyterhub[87737]: [I 2024-11-01 12:06:37.410 JupyterHub proxy:556] Generating new CONFIGPROXY_AUTH_TOKEN
Nov 01 15:06:37 pe-jupytr-pl1 jupyterhub[87737]: [D 2024-11-01 12:06:37.411 JupyterHub app:2104] Loading roles into database
Nov 01 15:06:37 pe-jupytr-pl1 jupyterhub[87737]: [I 2024-11-01 12:06:37.416 JupyterHub app:1984] Not using allowed_users. Any authenticated user will be allowed.
Nov 01 15:06:37 pe-jupytr-pl1 jupyterhub[87737]: [D 2024-11-01 12:06:37.419 JupyterHub app:2343] Purging expired APITokens
Nov 01 15:06:37 pe-jupytr-pl1 jupyterhub[87737]: [D 2024-11-01 12:06:37.421 JupyterHub app:2343] Purging expired OAuthCodes
Nov 01 15:06:37 pe-jupytr-pl1 jupyterhub[87737]: [D 2024-11-01 12:06:37.423 JupyterHub app:2179] Loading role assignments from config
Nov 01 15:06:37 pe-jupytr-pl1 jupyterhub[87737]: [D 2024-11-01 12:06:37.428 JupyterHub app:2502] Initializing spawners
Nov 01 15:06:37 pe-jupytr-pl1 jupyterhub[87737]: [D 2024-11-01 12:06:37.429 JupyterHub app:2633] Loaded users:
Nov 01 15:06:37 pe-jupytr-pl1 jupyterhub[87737]:
Nov 01 15:06:37 pe-jupytr-pl1 jupyterhub[87737]: [I 2024-11-01 12:06:37.430 JupyterHub app:2928] Initialized 0 spawners in 0.002 seconds
Nov 01 15:06:37 pe-jupytr-pl1 jupyterhub[87737]: [I 2024-11-01 12:06:37.433 JupyterHub metrics:278] Found 0 active users in the last ActiveUserPeriods.twenty_four_hours
Nov 01 15:06:37 pe-jupytr-pl1 jupyterhub[87737]: [I 2024-11-01 12:06:37.434 JupyterHub metrics:278] Found 3 active users in the last ActiveUserPeriods.seven_days
Nov 01 15:06:37 pe-jupytr-pl1 jupyterhub[87737]: [I 2024-11-01 12:06:37.434 JupyterHub metrics:278] Found 3 active users in the last ActiveUserPeriods.thirty_days
Nov 01 15:06:37 pe-jupytr-pl1 jupyterhub[87737]: [W 2024-11-01 12:06:37.435 JupyterHub proxy:746] Running JupyterHub without SSL. I hope there is SSL termination happening somewhere else…
Nov 01 15:06:37 pe-jupytr-pl1 jupyterhub[87737]: [I 2024-11-01 12:06:37.435 JupyterHub proxy:750] Starting proxy @ http://:8000
Nov 01 15:06:37 pe-jupytr-pl1 jupyterhub[87737]: [D 2024-11-01 12:06:37.435 JupyterHub proxy:751] Proxy cmd: [‘configurable-http-proxy’, ‘–ip’, ‘’, ‘–port’, ‘8000’, ‘–api-ip’, ‘127.0.0.1’, ‘–api-port’, ‘8001’, ‘–error-target’, ‘http:// 127.0.0.1:8081/hub/error’, ‘–log-level’, ‘info’]
Nov 01 15:06:37 pe-jupytr-pl1 jupyterhub[87737]: [D 2024-11-01 12:06:37.448 JupyterHub proxy:670] Writing proxy pid file: jupyterhub-proxy.pid
Nov 01 15:06:37 pe-jupytr-pl1 jupyterhub[87737]: [E 2024-11-01 12:06:37.454 JupyterHub utils:91] Unexpected error connecting to pe-jupytr-pl1:8000 [Errno 22] Invalid argument
Nov 01 15:06:37 pe-jupytr-pl1 jupyterhub[87737]: [E 2024-11-01 12:06:37.660 JupyterHub utils:91] Unexpected error connecting to pe-jupytr-pl1:8000 [Errno 22] Invalid argument
Nov 01 15:06:38 pe-jupytr-pl1 jupyterhub[87737]: [E 2024-11-01 12:06:38.011 JupyterHub utils:91] Unexpected error connecting to pe-jupytr-pl1:8000 [Errno 22] Invalid argument
Nov 01 15:06:38 pe-jupytr-pl1 jupyterhub[87737]: [E 2024-11-01 12:06:38.464 JupyterHub utils:91] Unexpected error connecting to pe-jupytr-pl1:8000 [Errno 22] Invalid argument
Nov 01 15:06:38 pe-jupytr-pl1 jupyterhub[87737]: [E 2024-11-01 12:06:38.512 JupyterHub utils:91] Unexpected error connecting to pe-jupytr-pl1:8000 [Errno 22] Invalid argument
Nov 01 15:06:38 pe-jupytr-pl1 jupyterhub[87737]: [E 2024-11-01 12:06:38.516 JupyterHub utils:91] Unexpected error connecting to pe-jupytr-pl1:8000 [Errno 22] Invalid argument
Nov 01 15:06:38 pe-jupytr-pl1 jupyterhub[87737]: [E 2024-11-01 12:06:38.687 JupyterHub utils:91] Unexpected error connecting to pe-jupytr-pl1:8000 [Errno 22] Invalid argument
Nov 01 15:06:38 pe-jupytr-pl1 jupyterhub[87737]: [E 2024-11-01 12:06:38.746 JupyterHub utils:91] Unexpected error connecting to pe-jupytr-pl1:8000 [Errno 22] Invalid argument
Nov 01 15:06:39 pe-jupytr-pl1 jupyterhub[87765]: 12:06:39.332 [ConfigProxy] info: Proxying http://:8000 to (no default)
Nov 01 15:06:39 pe-jupytr-pl1 jupyterhub[87765]: 12:06:39.348 [ConfigProxy] info: Proxy API at http:// 127.0.0.1:8001/api/routes
Nov 01 15:06:39 pe-jupytr-pl1 jupyterhub[87737]: [D 2024-11-01 12:06:39.385 JupyterHub proxy:787] Proxy started and appears to be up
Nov 01 15:06:39 pe-jupytr-pl1 jupyterhub[87737]: [D 2024-11-01 12:06:39.385 JupyterHub proxy:880] Proxy: Fetching GET http:// 127.0.0.1:8001/api/routes
Nov 01 15:06:39 pe-jupytr-pl1 jupyterhub[87765]: 12:06:39.397 [ConfigProxy] info: 200 GET /api/routes
Nov 01 15:06:39 pe-jupytr-pl1 jupyterhub[87737]: [I 2024-11-01 12:06:39.398 JupyterHub app:3178] Hub API listening on http:// 127.0.0.1:8081/hub/
Nov 01 15:06:39 pe-jupytr-pl1 jupyterhub[87737]: [D 2024-11-01 12:06:39.398 JupyterHub proxy:389] Fetching routes to check
Nov 01 15:06:39 pe-jupytr-pl1 jupyterhub[87737]: [D 2024-11-01 12:06:39.398 JupyterHub proxy:880] Proxy: Fetching GET http:// 127.0.0.1:8001/api/routes
Nov 01 15:06:39 pe-jupytr-pl1 jupyterhub[87765]: 12:06:39.400 [ConfigProxy] info: 200 GET /api/routes
Nov 01 15:06:39 pe-jupytr-pl1 jupyterhub[87737]: [D 2024-11-01 12:06:39.400 JupyterHub proxy:392] Checking routes
Nov 01 15:06:39 pe-jupytr-pl1 jupyterhub[87737]: [I 2024-11-01 12:06:39.400 JupyterHub proxy:477] Adding route for Hub: / => http:// 127.0.0.1:8081
Nov 01 15:06:39 pe-jupytr-pl1 jupyterhub[87737]: [D 2024-11-01 12:06:39.401 JupyterHub proxy:880] Proxy: Fetching POST http:// 127.0.0.1:8001/api/routes/
Nov 01 15:06:39 pe-jupytr-pl1 jupyterhub[87765]: 12:06:39.403 [ConfigProxy] info: Adding route / → http:// 127.0.0.1:8081
Nov 01 15:06:39 pe-jupytr-pl1 jupyterhub[87765]: 12:06:39.404 [ConfigProxy] info: Route added / → http:// 127.0.0.1:8081
Nov 01 15:06:39 pe-jupytr-pl1 jupyterhub[87765]: 12:06:39.404 [ConfigProxy] info: 201 POST /api/routes/
Nov 01 15:06:39 pe-jupytr-pl1 jupyterhub[87737]: [I 2024-11-01 12:06:39.405 JupyterHub app:3245] JupyterHub is now running at http://:8000
Nov 01 15:06:39 pe-jupytr-pl1 jupyterhub[87737]: [D 2024-11-01 12:06:39.406 JupyterHub app:2852] It took 3.460 seconds for the Hub to start
Nov 01 15:06:50 pe-jupytr-pl1 jupyterhub[87737]: [I 2024-11-01 12:06:50.679 JupyterHub log:191] 302 GET / → /hub/ (@::ffff:172.24.5.99) 1.13ms
Nov 01 15:06:50 pe-jupytr-pl1 jupyterhub[87737]: [I 2024-11-01 12:06:50.721 JupyterHub log:191] 302 GET /hub/ → /hub/login?next=%2Fhub%2F (@::ffff:172.24.5.99) 0.50ms
Nov 01 15:06:50 pe-jupytr-pl1 jupyterhub[87737]: [I 2024-11-01 12:06:50.862 JupyterHub log:191] 200 GET /hub/login?next=%2Fhub%2F (@::ffff:172.24.5.99) 102.51ms
Nov 01 15:06:50 pe-jupytr-pl1 jupyterhub[87737]: [D 2024-11-01 12:06:50.961 JupyterHub log:191] 200 GET /hub/static/css/style.min.css?v=01598a5386176f0279952a3b9632a07e7fce9a12aa53108973c83be9ec3473e7a59354876fab64bfeb01892eb503870183707aa03f207d7a94845ca7980c3819 (@::ffff:172.24.5.99) 18.93ms
Nov 01 15:06:50 pe-jupytr-pl1 jupyterhub[87737]: [D 2024-11-01 12:06:50.995 JupyterHub log:191] 200 GET /hub/logo (@::ffff:172.24.5.99) 3.81ms
Nov 01 15:06:50 pe-jupytr-pl1 jupyterhub[87737]: [D 2024-11-01 12:06:50.997 JupyterHub log:191] 200 GET /hub/static/components/bootstrap/dist/js/bootstrap.min.js?v=a014e9acc78d10a0a7a9fbaa29deac6ef17398542d9574b77b40bf446155d210fa43384757e3837da41b025998ebfab4b9b6f094033f9c226392b800df068bce (@::ffff:172.24.5.99) 1.28ms
Nov 01 15:06:50 pe-jupytr-pl1 jupyterhub[87737]: [D 2024-11-01 12:06:50.999 JupyterHub log:191] 200 GET /hub/static/components/jquery/dist/jquery.min.js?v=de027062931edd07b01842eff24fc15fdbdcaa1af245dcd133155faba9e0c965f0a34dc6144ce3b149bc43b4597073c792cb6dabbfc6168c63095523923bcf77 (@::ffff:172.24.5.99) 1.66ms
Nov 01 15:06:51 pe-jupytr-pl1 jupyterhub[87737]: [D 2024-11-01 12:06:51.000 JupyterHub log:191] 200 GET /hub/static/components/requirejs/require.js?v=bd1aa102bdb0b27fbf712b32cfcd29b016c272acf3d864ee8469376eaddd032cadcf827ff17c05a8c8e20061418fe58cf79947049f5c0dff3b4f73fcc8cad8ec (@::ffff:172.24.5.99) 2.16ms
Nov 01 15:06:51 pe-jupytr-pl1 jupyterhub[87737]: [D 2024-11-01 12:06:51.191 JupyterHub log:191] 200 GET /hub/static/favicon.ico?v=fde5757cd3892b979919d3b1faa88a410f28829feb5ba22b6cf069f2c6c98675fceef90f932e49b510e74d65c681d5846b943e7f7cc1b41867422f0481085c1f (@::ffff:172.24.5.99) 1.21ms
Nov 01 15:06:54 pe-jupytr-pl1 jupyterhub[87737]: [D 2024-11-01 12:06:54.715 JupyterHub log:191] 200 GET /hub/static/components/font-awesome/fonts/fontawesome-webfont.woff2?v=4.7.0 (@::ffff:172.24.5.99) 3.52ms
Nov 01 15:06:55 pe-jupytr-pl1 jupyterhub[87737]: [D 2024-11-01 12:06:55.610 JupyterHub ldapauthenticator:256] Looking up user with:
Nov 01 15:06:55 pe-jupytr-pl1 jupyterhub[87737]: search_base = ‘dc=domain,dc=local’
Nov 01 15:06:55 pe-jupytr-pl1 jupyterhub[87737]: search_filter = ‘(sAMAccountName=furkan.gayir)’
Nov 01 15:06:55 pe-jupytr-pl1 jupyterhub[87737]: attributes = ‘sAMAccountName’
Nov 01 15:06:55 pe-jupytr-pl1 jupyterhub[87737]: [D 2024-11-01 12:06:55.628 JupyterHub ldapauthenticator:379] Attempting to bind furkan.gayir with CN=
***
Nov 01 15:06:55 pe-jupytr-pl1 jupyterhub[87737]: [D 2024-11-01 12:06:55.914 JupyterHub ldapauthenticator:392] Status of user bind furkan.gayir with CN=**** : True
Nov 01 15:06:55 pe-jupytr-pl1 jupyterhub[87737]: [D 2024-11-01 12:06:55.918 JupyterHub roles:281] Assigning default role to User furkan.gayir
Nov 01 15:06:55 pe-jupytr-pl1 jupyterhub[87737]: [D 2024-11-01 12:06:55.921 JupyterHub base:587] Setting cookie jupyterhub-session-id: {‘httponly’: True, ‘path’: ‘/’}
Nov 01 15:06:55 pe-jupytr-pl1 jupyterhub[87737]: [D 2024-11-01 12:06:55.921 JupyterHub base:591] Setting cookie for furkan.gayir: jupyterhub-hub-login
Nov 01 15:06:55 pe-jupytr-pl1 jupyterhub[87737]: [D 2024-11-01 12:06:55.921 JupyterHub base:587] Setting cookie jupyterhub-hub-login: {‘httponly’: True, ‘path’: ‘/hub/’}
Nov 01 15:06:55 pe-jupytr-pl1 jupyterhub[87737]: [I 2024-11-01 12:06:55.922 JupyterHub base:837] User logged in: furkan.gayir
Nov 01 15:06:55 pe-jupytr-pl1 jupyterhub[87737]: [I 2024-11-01 12:06:55.922 JupyterHub log:191] 302 POST /hub/login?next=%2Fhub%2F → /hub/ (furkan.gayir@::ffff:172.24.5.99) 1202.88ms
Nov 01 15:06:55 pe-jupytr-pl1 jupyterhub[87737]: [D 2024-11-01 12:06:55.978 JupyterHub user:431] Creating <class ‘jupyterhub.spawner.LocalProcessSpawner’> for furkan.gayir:
Nov 01 15:06:55 pe-jupytr-pl1 jupyterhub[87737]: [I 2024-11-01 12:06:55.979 JupyterHub log:191] 302 GET /hub/ → /hub/spawn (furkan.gayir@::ffff:172.24.5.99) 14.35ms
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: [D 2024-11-01 12:06:56.031 JupyterHub scopes:877] Checking access to /hub/spawn via scope servers
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: [D 2024-11-01 12:06:56.031 JupyterHub scopes:690] Argument-based access to /hub/spawn via servers
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: [D 2024-11-01 12:06:56.031 JupyterHub pages:217] Triggering spawn with default options for furkan.gayir
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: [D 2024-11-01 12:06:56.031 JupyterHub base:961] Initiating spawn for furkan.gayir
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: [D 2024-11-01 12:06:56.031 JupyterHub base:965] 0/100 concurrent spawns
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: [D 2024-11-01 12:06:56.031 JupyterHub base:970] 0 active servers
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: [I 2024-11-01 12:06:56.046 JupyterHub provider:659] Creating oauth client jupyterhub-user-furkan.gayir
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: [D 2024-11-01 12:06:56.053 JupyterHub user:794] Calling Spawner.start for furkan.gayir
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: [I 2024-11-01 12:06:56.056 JupyterHub spawner:1689] Spawning jupyterhub-singleuser
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: [E 2024-11-01 12:06:56.064 JupyterHub user:884] Unhandled error starting furkan.gayir’s server: Exception occurred in preexec_fn.
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: Traceback (most recent call last):
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: File “/data1/conda/lib/python3.11/site-packages/jupyterhub/user.py”, line 798, in spawn
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: url = await gen.with_timeout(timedelta(seconds=spawner.start_timeout), f)
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: File “/data1/conda/lib/python3.11/site-packages/jupyterhub/spawner.py”, line 1699, in start
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: self.proc = Popen(cmd, **popen_kwargs)
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: ^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: File “/data1/conda/lib/python3.11/subprocess.py”, line 1026, in init
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: self._execute_child(args, executable, preexec_fn, close_fds,
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: File “/data1/conda/lib/python3.11/subprocess.py”, line 1951, in _execute_child
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: raise child_exception_type(err_msg)
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: subprocess.SubprocessError: Exception occurred in preexec_fn.
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]:
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: [D 2024-11-01 12:06:56.080 JupyterHub user:982] Stopping furkan.gayir
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: [D 2024-11-01 12:06:56.093 JupyterHub user:1002] Deleting oauth client jupyterhub-user-furkan.gayir
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: [D 2024-11-01 12:06:56.097 JupyterHub user:1005] Finished stopping furkan.gayir
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: [E 2024-11-01 12:06:56.100 JupyterHub pages:313] Error starting server furkan.gayir: Exception occurred in preexec_fn.
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: Traceback (most recent call last):
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: NoneType: None
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]:
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: [W 2024-11-01 12:06:56.100 JupyterHub web:1869] 500 GET /hub/spawn (::ffff:172.24.5.99): Unhandled error starting server furkan.gayir
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: [D 2024-11-01 12:06:56.100 JupyterHub base:1371] No template for 500
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: [E 2024-11-01 12:06:56.117 JupyterHub log:183] {
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: “X-Forwarded-Host”: “192.168.176.197:8000”,
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: “X-Forwarded-Proto”: “http”,
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: “X-Forwarded-Port”: “8000”,
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: “X-Forwarded-For”: “::ffff:172.24.5.99”,
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: “Cookie”: “_xsrf=[secret]; jupyterhub-hub-login=[secret]; jupyterhub-session-id=[secret]”,
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: “Accept-Language”: “tr”,
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: “Accept-Encoding”: “gzip, deflate”,
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: “Referer”: “http:// 192.168.176.197:8000/hub/login?next=%2Fhub%2F”,
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: “Accept”: “text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.7”,
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: “User-Agent”: “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36 Edg/130.0.0.0”,
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: “Upgrade-Insecure-Requests”: “1”,
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: “Cache-Control”: “max-age=0”,
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: “Connection”: “keep-alive”,
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: “Host”: “192.168.176.197:8000”
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: }
Nov 01 15:06:56 pe-jupytr-pl1 jupyterhub[87737]: [E 2024-11-01 12:06:56.117 JupyterHub log:191] 500 GET /hub/spawn (furkan.gayir@::ffff:172.24.5.99) 88.16ms

Jupyterhub_config.py:

c.JupyterHub.authenticator_class = ‘ldapauthenticator.LDAPAuthenticator’

c.LDAPAuthenticator.server_address = “domain.local”

c.LDAPAuthenticator.server_port = 389

c.LDAPAuthenticator.lookup_dn = True

c.LDAPAuthenticator.lookup_dn_search_filter = ‘(sAMAccountName={login})’

c.LDAPAuthenticator.lookup_dn_search_user = ‘user@domain’

c.LDAPAuthenticator.lookup_dn_search_password = ‘passwd’

c.LDAPAuthenticator.user_search_base = ‘dc=domain,dc=local’

c.LDAPAuthenticator.user_attribute = ‘sAMAccountName’

c.LDAPAuthenticator.lookup_dn_user_dn_attribute = ‘sAMAccountName’

c.LDAPAuthenticator.use_ssl = False

You are using LocalProcessSpawner which requires a local UNIX account on your JupyterHub server with the name furkan.gayir. Are you sure you have account exists on the JupyterHub server?

1 Like

Yes, I tried creating this user on the jupyter server and the result is the same. Why is it asking for a local unix account when I can authenticate via ldap? What should I do to overcome this problem?

The authenticator only takes care of identifying the user. You’re using LocalProcessSpawner which also requires a JupyterHub user to have a corresponding local operating system user. One way is to ensure your operating system uses LDAP too, e.g. see
https://wiki.archlinux.org/title/LDAP_authentication#Client_setup
and there are plenty of other guides.

If you don’t want this you could look at DockerSpawner.

1 Like

I solved the problem and logged in successfully. For reference, here are the parameters I added.
I added the following to jupyterhub_config.py:
def pre_spawn_hook(spawner):
username = spawner.user.name
try:
import pwd
pwd.getpwnam(username)
except KeyError
import subprocess
subprocess.check_call([“sudo”, “useradd”, “-ms”, “/bin/bash”, username])
c.Spawner.pre_spawn_hook = pre_spawn_hook
c.Spawner.cmd = [‘/data1/conda/bin/jupyterhub-singleuser’]
I changed the User in /etc/systemd/system/jupyter.service to root.

Thank you for everybody !