jupyterhub / tmpauthenticator

JupyterHub authenticator that hands out temporary accounts for everyone. For use in tmpnb.org
BSD 3-Clause "New" or "Revised" License
22 stars 18 forks source link

User not found #10

Closed emptycrown closed 1 year ago

emptycrown commented 6 years ago

Hi, I just started a new Jupyterhub and added in tmpauthenticator. My jupyterhub_config.py file looks like this:

import tmpauthenticator
c.JupyterHub.authenticator_class = tmpauthenticator.TmpAuthenticator

However, when I connect with my client and actually start the server, I get a 500 Server Error. WIth this error on the server:

Traceback (most recent call last):
      File "/home/ubuntu/.local/lib/python3.5/site-packages/tornado/web.py", line 1512, in _execute
        result = yield result
      File "/home/ubuntu/.local/lib/python3.5/site-packages/jupyterhub/handlers/base.py", line 747, in get
        yield self.spawn_single_user(current_user)
      File "/home/ubuntu/.local/lib/python3.5/site-packages/jupyterhub/handlers/base.py", line 475, in spawn_single_user
        yield gen.with_timeout(timedelta(seconds=self.slow_spawn_timeout), finish_spawn_future)
      File "/home/ubuntu/.local/lib/python3.5/site-packages/jupyterhub/handlers/base.py", line 445, in finish_user_spawn
        yield spawn_future
      File "/home/ubuntu/.local/lib/python3.5/site-packages/jupyterhub/user.py", line 439, in spawn
        raise e
      File "/home/ubuntu/.local/lib/python3.5/site-packages/jupyterhub/user.py", line 378, in spawn
        ip_port = yield gen.with_timeout(timedelta(seconds=spawner.start_timeout), f)
      File "/usr/lib/python3.5/types.py", line 243, in wrapped
        coro = func(*args, **kwargs)
      File "/home/ubuntu/.local/lib/python3.5/site-packages/jupyterhub/spawner.py", line 968, in start
        env = self.get_env()
      File "/home/ubuntu/.local/lib/python3.5/site-packages/jupyterhub/spawner.py", line 960, in get_env
        env = self.user_env(env)
      File "/home/ubuntu/.local/lib/python3.5/site-packages/jupyterhub/spawner.py", line 947, in user_env
        home = pwd.getpwnam(self.user.name).pw_dir
    KeyError: 'getpwnam(): xxxxxx'

Does anyone know what could be the issue?

yuvipanda commented 6 years ago

Thank you for opening the issue. What spawner are you using it with? I'd recommend something containerized, both for security and ease of use reasons. This looks like the default spawner, which requires user accounts be created on the system for each user spawned. That's sortof dangerous, and I'd recommend against doing that.

emptycrown commented 6 years ago

@yuvipanda Thanks for the reply. I'm now trying to get it working with DockerSpawner. However, just adding the line

c.JupyterHub.spawner_class = 'dockerspawner.DockerSpawner'

to jupyter_config.py yields

docker.errors.ImageNotFound: 404 Client Error: Not Found ("No such image: jupyterhub/singleuser:0.8")

Even after I've pulled the Docker images. What should be the general strategy for getting a server working that generates temporary docker containers for all users, using tmpauthenticator and dockerspawner? Thanks!

marcioribeirop commented 6 years ago

You need the Docker image mentioned in the error message. docker pull jupyterhub/singleuser:0.8