jupyterhub-ldap-authenticator icon indicating copy to clipboard operation
jupyterhub-ldap-authenticator copied to clipboard

Failed to create system user

Open jameholme opened this issue 5 years ago • 7 comments

[I 2019-10-04 14:20:32.534 JupyterHub ldapauthenticator:290] Creating 'jholme' user home directory using command 'mkhomedir_helper jholme'
[E 2019-10-04 14:20:32.538 JupyterHub web:1788] Uncaught exception POST /hub/login?next= (::ffff:IPADDRESS)
    HTTPServerRequest(protocol='https', host='company.com', method='POST', uri='/hub/login?next=', version='HTTP/1.1', remote_ip='::ffff:IPADDRESS)
    Traceback (most recent call last):
      File "/usr/local/lib64/python3.6/site-packages/tornado/web.py", line 1699, in _execute
        result = await result
      File "/usr/local/lib/python3.6/site-packages/jupyterhub/handlers/login.py", line 144, in post
        user = await self.login_user(data)
      File "/usr/local/lib/python3.6/site-packages/jupyterhub/handlers/base.py", line 697, in login_user
        user = await self.auth_to_user(authenticated)
      File "/usr/local/lib/python3.6/site-packages/jupyterhub/handlers/base.py", line 676, in auth_to_user
        await maybe_future(self.authenticator.add_user(user))
      File "/usr/local/lib/python3.6/site-packages/ldapauthenticator/ldapauthenticator.py", line 269, in add_user
        yield gen.maybe_future(self.add_user_home_dir(username))
      File "/usr/local/lib/python3.6/site-packages/ldapauthenticator/ldapauthenticator.py", line 295, in add_user_home_dir
        raise RuntimeError("Failed to create system user %s: %s" % (username, err))
    RuntimeError: Failed to create system user jholme:

[E 2019-10-04 14:20:32.548 JupyterHub log:166] {
      "X-Forwarded-Host": "company.com",
      "X-Forwarded-Proto": "https",
      "X-Forwarded-Port": "443",
      "X-Forwarded-For": "::ffff:IPADDRESS",
      "Accept-Language": "en-US,en;q=0.9",
      "Accept-Encoding": "gzip, deflate, br",
      "Referer": "https://company.com/hub/login",
      "Sec-Fetch-Site": "same-origin",
      "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3",
      "Sec-Fetch-User": "?1",
      "Sec-Fetch-Mode": "navigate",
      "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36",
      "Content-Type": "application/x-www-form-urlencoded",
      "Upgrade-Insecure-Requests": "1",
      "Origin": "https://company.com",
      "Cache-Control": "max-age=0",
      "Content-Length": "51",
      "Connection": "close",
      "Host": "company.com"
    }
[E 2019-10-04 14:20:32.548 JupyterHub log:174] 500 POST /hub/login?next= (@::ffff:IPADDRESS 796.90ms

As you can see, it authenticates against the LDAP server, but fails to create user/home directory

jameholme avatar Oct 04 '19 14:10 jameholme

Same issue. Any updates on this?

enlznep avatar Oct 08 '19 03:10 enlznep

No updates. I am still unable to resolve this. It seems the 'mkhomedir_helper' isn't working. Even when I attempt it manually on the CLI, it does nothing.

jameholme avatar Oct 08 '19 13:10 jameholme

Had the same issue and used the following command to get around the error: c.LDAPAuthenticator.create_user_home_dir_cmd = ['adduser', '-m']

arunoruto avatar Nov 02 '19 16:11 arunoruto

Did you have to update the ldap auth script? Or just the jupyterhub config file? I will try this out on Monday, thanks!

jameholme avatar Nov 03 '19 16:11 jameholme

Did you have to update the ldap auth script? Or just the jupyterhub config file? I will try this out on Monday, thanks!

I used a new container every time I was trying to figure out to make it work. So I just tried to see what will happen and it worked like a charm. I don't know if this is a valid fix or a temporary workaround, but it does the same thing as mkhomedir_helpmer but also adds the user to the system (which was the problem for me).

arunoruto avatar Nov 03 '19 22:11 arunoruto

Same here, I tried it out, -m didn't work for me, had to use --create-home.

Otherwise it worked! Thanks!

jameholme avatar Nov 04 '19 20:11 jameholme

Had the same issue and used the following command to get around the error: c.LDAPAuthenticator.create_user_home_dir_cmd = ['adduser', '-m']

Faced the same problem, saw this post and found solution with one small correction. The command to be used is useradd and NOT adduser. The useradd has the -m or --create-home paramater

billtzim avatar Nov 10 '22 20:11 billtzim