jupyterhub / sudospawner

Spawn JupyterHub single-user servers with sudo
BSD 3-Clause "New" or "Revised" License
50 stars 41 forks source link

Multi user login fails #50

Closed akhilputhiry closed 6 years ago

akhilputhiry commented 6 years ago

I am running jupyterhub as root user.

I have 2 other users,

I am able to login with alawrence. But when I try to login with puthiry, I am getting the following error

[I 2018-05-14 06:37:09.876 JupyterHub log:122] 302 GET /user/puthiry/ → /hub/user/puthiry/ (@::ffff:10.0.2.2) 18.90ms
sudo: unable to execute /home/alawrence/dev/jupyter/lab/bin/sudospawner: Permission denied
[E 2018-05-14 06:37:10.492 JupyterHub spawner:83] Failed to get JSON result from mediator: ''
[E 2018-05-14 06:37:10.520 JupyterHub user:427] Unhandled error starting puthiry's server: substring not found
[E 2018-05-14 06:37:10.692 JupyterHub web:1621] Uncaught exception GET /hub/user/puthiry/ (::ffff:10.0.2.2)
    HTTPServerRequest(protocol='http', host='localhost:8000', method='GET', uri='/hub/user/puthiry/', version='HTTP/1.1', remote_ip='::ffff:10.0.2.2')
    Traceback (most recent call last):
      File "/home/alawrence/dev/jupyter/lab/lib/python3.6/site-packages/tornado/web.py", line 1543, in _execute
        result = yield result
      File "/home/alawrence/dev/jupyter/lab/lib/python3.6/site-packages/jupyterhub/handlers/base.py", line 747, in get
        yield self.spawn_single_user(current_user)
      File "/home/alawrence/dev/jupyter/lab/lib/python3.6/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/alawrence/dev/jupyter/lab/lib/python3.6/site-packages/jupyterhub/handlers/base.py", line 445, in finish_user_spawn
        yield spawn_future
      File "/home/alawrence/dev/jupyter/lab/lib/python3.6/site-packages/jupyterhub/user.py", line 439, in spawn
        raise e
      File "/home/alawrence/dev/jupyter/lab/lib/python3.6/site-packages/jupyterhub/user.py", line 378, in spawn
        ip_port = yield gen.with_timeout(timedelta(seconds=spawner.start_timeout), f)
      File "/home/alawrence/dev/jupyter/lab/lib/python3.6/site-packages/sudospawner/spawner.py", line 92, in start
        reply = yield self.do(action='spawn', args=self.get_args(), env=self.get_env())
      File "/home/alawrence/dev/jupyter/lab/lib/python3.6/site-packages/sudospawner/spawner.py", line 80, in do
        data_str = data_str[data_str.index('{'):data_str.rindex('}')+1]
    ValueError: substring not found

[E 2018-05-14 06:37:10.860 JupyterHub log:114] {
      "X-Forwarded-Host": "localhost:8000",
      "X-Forwarded-Proto": "http",
      "X-Forwarded-Port": "8000",
      "X-Forwarded-For": "::ffff:10.0.2.2",
      "Upgrade-Insecure-Requests": "1",
      "Connection": "close",
      "Dnt": "1",
      "Cookie": "jupyter-hub-token=\"2|1:0|10:1526293512|17:jupyter-hub-token|44:MmIxYjM2YWM4MTJkNDg0NWFmM2NmNzM2MmExZGM4ODM=|e8aeee3929320302dc2d38569c3914a0360b03ac1f224e56188047e14c474979\"",
      "Referer": "http://localhost:8000/hub/home",
      "Accept-Encoding": "gzip, deflate",
      "Accept-Language": "en-US,en;q=0.5",
      "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
      "User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0",
      "Host": "localhost:8000"
    }
[E 2018-05-14 06:37:10.867 JupyterHub log:122] 500 GET /hub/user/puthiry/ (puthiry@::ffff:10.0.2.2) 896.26ms
minrk commented 6 years ago

I am running jupyterhub as root user.

Sudospawner is not the right choice if jupyterhub is already root. The default spawner is a simpler and better implementation for this case. So the simple answer is to not use sudospawner.

Using sudospawner requires configuring the sudoers file to work. My guess is that this doesn't have the right user lists configured, but the answer is probably to not use sudospawner in your case.