Setup Jupyterhub setup with NativeAuthenticator

Hello All
i am setting up jupyterhub server for the firts time and need some help am having couple of issues i am trying to setup jupyterhub server on redhat linux with NativeAuthenticator in the jupyterconfig.py file but when i run the jupyterhub it allows me to create a username and password but when i try to log in it does not log in and even when i try to log in with root user , the other thing is am not able to access the admin page to authorize the user can anybody please guide me on how would i go about fixing the issue
Thanks
sudi

Hey @sudi007!

When you’re adding a new user through the signup page (/hub/signup), that user will be able to login only after it was authorized by an admin.

If you’re using NativeAuthenticator for the first time and don’t have any admin configured, you’ll have to:

  • Add the admin user to the JupyterHub admin list. In jupyterhub_config.py add:
    c.NativeAuthenticator.admin_users = {'<your-admin-user'>}
  • Register that admin with NativeAuthenticator through the signup page (go to /hub/signup and add <your-admin-user> and set a password for it)
  • Login as <your-admin-user> using the credentials you just set.

Now that you’re logged in as an admin user, from the admin panel you’ll be able to authorize any user added trough the signup page.

(Linked GitHub issues: https://github.com/jupyterhub/jupyterhub/issues/2988 and https://github.com/jupyterhub/nativeauthenticator/issues/104)

1 Like

Hello Georgiana Elena

Thanks for the insight was able to get that resolved the issue but am still having an issue with when i authorize the user and login with that user name i get and error

500 : Internal Server Error

Error in Authenticator.pre_spawn_start: KeyError “getpwnam(): name not found: ‘admin’”

You can try restarting your server from the home page.doing research i found that user that was created does not have access though the user is authorize so how do i go about giving them access without making them admin

To give access to a user, navigate to /hub/authorize (from an admin account) and press the Authorize button for that user (checkout the docs).

When you hit that Authorize button, you are not making the user an admin, you’re just giving them access to login to JupyterHub.

so when i authorize the user and log inwith that user account i get the following error

500 : Internal Server Error

Error in Authenticator.pre_spawn_start: KeyError “getpwnam(): name not found: ‘admin’”

You can try restarting your server from the home page

Hi there, I am - as we speak - experiencing the same problem. Have you found, by any chance, a solution yet?

@Nenoo i am still experiencing the same problem have not found any solution yet,am still searching for the solution

Thanks

@sudi007, if you’re using the default JupyterHub spawner (LocalProcessSpawner), then you have to make sure that for each authenticated user, there is also a matching local UNIX user.
(The useradd command can be used to create the admin user on your system.)

Yes am using local spwaner but i dont users to be admin for the machine when i add them is there any simple i can add users without being admin so they get access to resources

Thanks

Sudesh

Anyone figure this out? I’m also having the same issue. I can whitelist the user as the admin and get to the admin page but I still cant generate a server, i get 500 error. Thanks

I realise it’s been a while since the last post in this topic, but it pops up in searches and I wanted to leave a resolution here for future travellers.

I maintain the NativeAuthenticator and this 500 error is a pretty popular one. In all instances known to me it was always a problem with the machine that was running JupyterHub not having an account for the account in question. They don’t need to be admins on the machine, but they need an account (with a home directory for their files and such).

You can either add them all manually or add a snippet to the configuration file that automatically creates them when they log in (linked at the end of this entry).

3 Likes

Hi, I’d like to share my case for reference. I created a user on Linux(RHEL) with a username that contains capital letters. Then, I signed up on /hub/signup using the same username and authorized it on /hub/authorize. However, JupyterHub automatically normalized the registered username so that all letters were lowercase (this is probably the default behavior of JupyterHub’s feature). Because of this, the Linux username and the JupyterHub username did not match, causing the 500 error.

In my environment, there is no problem in limiting all Linux usernames to lower case. Therefore, I took care of it that way.

How would one setup similar behavior if using a 3rd party authenticator like KeyCloak via the c.JupyterHub.authenticator_class = GenericOAuthenticator?

I’m able to get JupyterHub to redirect to KeyCloak, then users login in there, and are then redirected back to the JupyterHub page, but cannot start their own server because they don’t have their own user.

I’m currently using c.JupyterHub.spawner_class = 'jupyterhub.spawner.SimpleLocalProcessSpawner' and this fails to start a server (which is expected, because as I understand, this spawner requires a local user account that matches the authenticated user).