'Jupyterhub authenticator “invalid username or password” with users that are clearly valid

Obs: this question is duplicated here.

Hello all. Im configuring a jupyterhub server in an ubuntu machine. According to this page, not setting a specific c.Authenticator.allowed_users will automatically set to default and allow for all authenticated users. My server does not have any c.Authenticator.allowed_users property set, however it displays “Invalid username or password” to some users that exist in the domain and can, for example, ssh into the server machine.

Do i need to set any specific configuration that im not aware of?

If it helps, my machine gets a lot of info about authenticated users from the domain, so not everything is stored locally. For example,

cat /etc/passwd

results in a short list of users info while

getent passwd

Results in a much longer list. Is this affecting my server somehow?

Invalid login screen:

enter image description here

Server configuration code:

c.JupyterHub.bind_url = 'http://:8000/jupyter'
c.JupyterHub.pid_file = '/etc/jupyterhub/jupyterhub.pid'
c.JupyterHub.shutdown_on_logout = True
c.JupyterHub.spawner_class = 'lnlsSpawner.spawner.spawner'
c.Spawner.env_keep = ['PATH', 'PYTHONPATH', 'CONDA_ROOT', 'CONDA_DEFAULT_ENV', 'VIRTUAL_ENV', 'LANG', 'LC_ALL', 'PYDM_DEFAULT_PROTOCOL', 'EPICS_CA_ADDR_LIST']
c.Spawner.notebook_dir = '~/' #Added for testing. Should be removed?


Solution 1:[1]

This solution is obviously not ideal, but worked for me. Since i tried some of the class Authenticator methods and nothing more direct worked, i added:

names = subprocess.check_output(["getent","passwd"])
names=names.decode()
names=names.split("\n")
for i in range(0,len(names)):
    names[i]=names[i].split(":")[0]
names=set(names)
c.Authenticator.allowed_users = names

To the jupyterhub configuration file. So now it gets all users from getent passwd and allows them to log.

Suggestions on better solutions would still be welcome, though.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Marco Montevechi Filho