I can't login my JupyterHub even once

I’ve install jupyterhub 4.0.1 on my tencentcloud which based on centos 7.9.
below is my jupyterhub_config.py


c = get_config()  #noqa

#  Default: False
c.JupyterHub.admin_access = True

c.JupyterHub.hub_ip = ''

c.JupyterHub.port = 9000

c.JupyterHub.shutdown_on_logout = True

c.Spawner.args = ['--allow-root']

c.Spawner.default_url = '/lab'

c.Spawner.notebook_dir = '~/usr/jupyter-notebook'

c.PAMAuthenticator.encoding = 'utf8'

c.Authenticator.admin_users = {'admin', 'root', 'lighthouse'}
c.DummyAuthenticator.password = "1"

c.LocalAuthenticator.create_system_users = True

# c.PAMAuthenticator.admin_groups = {'jupyterhub-users'}
c.LocalAuthenticator.add_user_cmd = ['adduser', '--gecos', '""', '--disabled-password']
c.PAMAuthenticator.open_sessions = False

c.Authenticator.allowed_users = {'admin', 'root', 'lighthouse'}

c.Authenticator.delete_invalid_users = True


I’ve reset add_user_cmd and set open_sessions False, however I can’t login my jupyterhub.
When I log in with admin or lighthouse, I would get [PAM Error 7], when I log in with root, I would get [PAM Error 3].

(jupyter-ai) [root@VM-0-11-centos jupyter-notebook]# jupyterhub
[I 2023-08-08 15:21:11.493 JupyterHub app:2859] Running JupyterHub version 4.0.1
[I 2023-08-08 15:21:11.493 JupyterHub app:2889] Using Authenticator: jupyterhub.auth.PAMAuthenticator-4.0.1
[I 2023-08-08 15:21:11.493 JupyterHub app:2889] Using Spawner: jupyterhub.spawner.LocalProcessSpawner-4.0.1
[I 2023-08-08 15:21:11.493 JupyterHub app:2889] Using Proxy: jupyterhub.proxy.ConfigurableHTTPProxy-4.0.1
[I 2023-08-08 15:21:11.500 JupyterHub app:1664] Loading cookie_secret from /usr/jupyter-notebook/jupyterhub_cookie_secret
[I 2023-08-08 15:21:11.536 JupyterHub proxy:556] Generating new CONFIGPROXY_AUTH_TOKEN
[I 2023-08-08 15:21:11.569 JupyterHub app:2928] Initialized 0 spawners in 0.002 seconds
[I 2023-08-08 15:21:11.573 JupyterHub metrics:278] Found 0 active users in the last ActiveUserPeriods.twenty_four_hours
[I 2023-08-08 15:21:11.574 JupyterHub metrics:278] Found 0 active users in the last ActiveUserPeriods.seven_days
[I 2023-08-08 15:21:11.574 JupyterHub metrics:278] Found 0 active users in the last ActiveUserPeriods.thirty_days
[W 2023-08-08 15:21:11.575 JupyterHub proxy:746] Running JupyterHub without SSL.  I hope there is SSL termination happening somewhere else...
[I 2023-08-08 15:21:11.575 JupyterHub proxy:750] Starting proxy @ http://:9000/
15:21:11.792 [ConfigProxy] info: Proxying http://*:9000 to (no default)
15:21:11.793 [ConfigProxy] info: Proxy API at http://127.0.0.1:8001/api/routes
[I 2023-08-08 15:21:12.391 JupyterHub app:3178] Hub API listening on http://*:8081/hub/
[I 2023-08-08 15:21:12.391 JupyterHub app:3180] Private Hub API connect url http://VM-0-11-centos:8081/hub/
15:21:12.392 [ConfigProxy] info: 200 GET /api/routes 
15:21:12.393 [ConfigProxy] info: 200 GET /api/routes 
[I 2023-08-08 15:21:12.393 JupyterHub proxy:477] Adding route for Hub: / => http://VM-0-11-centos:8081
15:21:12.395 [ConfigProxy] info: Adding route / -> http://VM-0-11-centos:8081
15:21:12.395 [ConfigProxy] info: Route added / -> http://VM-0-11-centos:8081
15:21:12.396 [ConfigProxy] info: 201 POST /api/routes/ 
[I 2023-08-08 15:21:12.396 JupyterHub app:3245] JupyterHub is now running at http://:9000/
[I 2023-08-08 15:21:43.687 JupyterHub log:191] 200 GET /hub/login?next=%2Fhub%2F (@::ffff:122.96.42.30) 18.72ms
[W 2023-08-08 15:22:04.393 JupyterHub auth:1112] PAM Authentication failed (admin@::ffff:122.96.42.30): [PAM Error 7] Authentication failure
[W 2023-08-08 15:22:04.394 JupyterHub base:841] Failed login for admin
[I 2023-08-08 15:22:04.395 JupyterHub log:191] 200 POST /hub/login?next=%2Fhub%2F (@::ffff:122.96.42.30) 1644.96ms
[W 2023-08-08 15:22:21.455 JupyterHub auth:1112] PAM Authentication failed (lighthouse@::ffff:122.96.42.30): [PAM Error 7] Authentication failure
[W 2023-08-08 15:22:21.455 JupyterHub base:841] Failed login for lighthouse
[I 2023-08-08 15:22:21.457 JupyterHub log:191] 200 POST /hub/login?next=%2Fhub%2F (@::ffff:122.96.42.30) 1644.51ms
[W 2023-08-08 15:22:33.600 JupyterHub auth:1112] PAM Authentication failed (root@::ffff:122.96.42.30): [PAM Error 3] Error in service module
[W 2023-08-08 15:22:33.600 JupyterHub base:841] Failed login for root
[I 2023-08-08 15:22:33.602 JupyterHub log:191] 200 POST /hub/login?next=%2Fhub%2F (@::ffff:122.96.42.30) 1624.96ms

What’s wrong with this?

From the looks of the config, it seems to be expecting to use the dummy authenticator, but it is not configured to do so. The dummy authenticator password is set to to ‘1’, but JupyterHub hasn’t been told to use the dummy authenticator:

c.JupyterHub.authenticator_class = 'dummy'

But also, please don’t use dummy authenticator with root as a real user. That would be extremely insecure. I assume this is just for testing so far.

Using the default PAM Authenticator may be desirable, in which case you’d need to use the real system passwords of the users to login (root usually doesn’t have a password these days, so can’t login). But users created by JupyterHub’s create_system_users don’t have passwords, so won’t be able to login until/unless you create a password for them.

2 Likes

great,I comment out dummy-password and created a new user ‘sndhmg’ with passwd, and then got another new error:
[Errno 13] Permission denied: ‘jupyterhub-singleuser’
Permission denied trying to run ‘/root/miniconda3/envs/jupyter-ai/bin/jupyterhub-singleuser’. Does sndhmg have access to this file?

If you’re using a virtualenv, you do need to make sure it’s one that all users can access. From the looks of it, you’ve put your env inside /root/, which generally isn’t world-readable. It needs to be world-readable and world-executable (or you can use groups, if you want to limit it for some reason).