Giter Club home page Giter Club logo

Comments (4)

user919lx avatar user919lx commented on June 19, 2024 4

I have same issue.Since nativeauthenticator doesn't inherit LocalAuthenticator,we can't set c.LocalAuthenticator.create_system_users = True

I solve it by setting config c.Spawner.pre_spawn_hook,so that everytime before jupyterhub spawns server,it will execute some python code.

for example

from subprocess import check_call

def create_system_user(spawner):
    username = spawner.user.name
    check_call(['bash', '/srv/jupyterhub/adduser.sh', username])

c.Spawner.pre_spawn_hook = create_system_user

adduser.sh code

adduser -q --gecos '""' --home /home/$1 --disabled-password  $1 || "True"

It will create system user if user not exists, otherwise return do nothing

from nativeauthenticator.

leportella avatar leportella commented on June 19, 2024 1

Hi @odovad sorry for the delay. I don't think we have create_system_users as an option on NativeAuth. Users must necessarily signup otherwise the system will not know them

from nativeauthenticator.

chicocvenancio avatar chicocvenancio commented on June 19, 2024

Initializing users is not behind any authentication, to create them I used a small script, maybe it is useful to someone else.

import requests
creds = [('user', 'good_password123')]

for cred in creds:
    requests.post('https://jupyterhub.mydomain.com/hub/signup', data={'username':cred[0], 'pw': cred[1]})

from nativeauthenticator.

Caiofcas avatar Caiofcas commented on June 19, 2024

Running jupyterhub inside docker with c.JupyterHub.spawner_class = 'jupyterhub.spawner.LocalProcessSpawner', what worked for me was (based on the answer above by @user919lx ):

def create_system_user(spawner):
    """Hook to create system user before spawning notebook. Required since NativeAuthenticator does not create users."""
    username = spawner.user.name
    check_call(['useradd', username, "-m"])


c.Spawner.pre_spawn_hook = create_system_user

from nativeauthenticator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.