Skip to content

I forgot my password. How do I log in? #51

Description

@adivekar-utexas

Bug description

I have forgotten my JupyterHub password, and now I cannot login.

Expected behaviour

There should be a "forgot password" page, or some way for an admin to reset a user's password.

Actual behaviour

I cannot log in.

How to reproduce

  1. Set a password.
  2. Do not remember the password.

Your personal set up

  • OS:
  • Version(s):

jupyterhub --version: 2.1.1

python --version: Python 3.8.12

  • Full environment
alembic @ file:///home/conda/feedstock_root/build_artifacts/alembic_1643780403162/work
anyio @ file:///tmp/build/80754af9/anyio_1644481698350/work/dist
argon2-cffi @ file:///opt/conda/conda-bld/argon2-cffi_1645000214183/work
argon2-cffi-bindings @ file:///tmp/build/80754af9/argon2-cffi-bindings_1644569684262/work
async-generator==1.10
attrs @ file:///home/conda/feedstock_root/build_artifacts/attrs_1640799537051/work
Babel @ file:///tmp/build/80754af9/babel_1620871417480/work
backcall @ file:///home/ktietz/src/ci/backcall_1611930011877/work
bcrypt==3.2.0
bleach @ file:///opt/conda/conda-bld/bleach_1641577558959/work
blinker==1.4
brotlipy==0.7.0
certifi==2021.10.8
certipy==0.1.3
cffi @ file:///opt/conda/conda-bld/cffi_1642701102775/work
charset-normalizer @ file:///home/conda/feedstock_root/build_artifacts/charset-normalizer_1644853463426/work
click==8.0.4
cloudpickle==2.0.0
cryptography @ file:///home/conda/feedstock_root/build_artifacts/cryptography_1634230276575/work
dask==2022.2.0
debugpy @ file:///tmp/build/80754af9/debugpy_1637091796427/work
decorator @ file:///opt/conda/conda-bld/decorator_1643638310831/work
defusedxml @ file:///tmp/build/80754af9/defusedxml_1615228127516/work
Deprecated==1.2.13
entrypoints @ file:///home/conda/feedstock_root/build_artifacts/entrypoints_1643888246732/work
filelock==3.6.0
fsspec==2022.2.0
grpcio==1.44.0
idna @ file:///home/conda/feedstock_root/build_artifacts/idna_1642433548627/work
importlib-metadata @ file:///home/conda/feedstock_root/build_artifacts/importlib-metadata_1644934520674/work
importlib-resources @ file:///home/conda/feedstock_root/build_artifacts/importlib_resources_1635615662634/work
ipykernel @ file:///tmp/build/80754af9/ipykernel_1633545412716/work/dist/ipykernel-6.4.1-py3-none-any.whl
ipython @ file:///tmp/build/80754af9/ipython_1643818147236/work
ipython-genutils @ file:///tmp/build/80754af9/ipython_genutils_1606773439826/work
jedi @ file:///tmp/build/80754af9/jedi_1644315233700/work
Jinja2 @ file:///home/conda/feedstock_root/build_artifacts/jinja2_1636510082894/work
json5 @ file:///tmp/build/80754af9/json5_1624432770122/work
jsonschema @ file:///home/conda/feedstock_root/build_artifacts/jsonschema-meta_1642000296051/work
jupyter-client @ file:///opt/conda/conda-bld/jupyter_client_1643638337975/work
jupyter-core @ file:///tmp/build/80754af9/jupyter_core_1636524756443/work
jupyter-server @ file:///opt/conda/conda-bld/jupyter_server_1644494914632/work
jupyter-telemetry @ file:///home/conda/feedstock_root/build_artifacts/jupyter_telemetry_1605173804246/work
jupyterhub @ file:///home/conda/feedstock_root/build_artifacts/jupyterhub-feedstock_1643124509075/work
jupyterhub-firstuseauthenticator==1.0.0
jupyterlab @ file:///opt/conda/conda-bld/jupyterlab_1644830542042/work
jupyterlab-pygments @ file:///tmp/build/80754af9/jupyterlab_pygments_1601490720602/work
jupyterlab-server @ file:///opt/conda/conda-bld/jupyterlab_server_1644500396812/work
locket==0.2.1
Mako @ file:///home/conda/feedstock_root/build_artifacts/mako_1637170539581/work
MarkupSafe @ file:///home/conda/feedstock_root/build_artifacts/markupsafe_1621455677251/work
matplotlib-inline @ file:///tmp/build/80754af9/matplotlib-inline_1628242447089/work
mistune==0.8.4
msgpack==1.0.3
nbclassic @ file:///opt/conda/conda-bld/nbclassic_1644943264176/work
nbclient @ file:///tmp/build/80754af9/nbclient_1645431659072/work
nbconvert @ file:///opt/conda/conda-bld/nbconvert_1641309195684/work
nbformat @ file:///tmp/build/80754af9/nbformat_1617383369282/work
nest-asyncio @ file:///tmp/build/80754af9/nest-asyncio_1613680548246/work
notebook @ file:///tmp/build/80754af9/notebook_1645002536250/work
numpy==1.22.2
oauthlib @ file:///home/conda/feedstock_root/build_artifacts/oauthlib_1643507977997/work
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
pamela==1.0.0
pandocfilters @ file:///opt/conda/conda-bld/pandocfilters_1643405455980/work
parso @ file:///opt/conda/conda-bld/parso_1641458642106/work
partd==1.2.0
pexpect @ file:///tmp/build/80754af9/pexpect_1605563209008/work
pickleshare @ file:///tmp/build/80754af9/pickleshare_1606932040724/work
prometheus-client @ file:///home/conda/feedstock_root/build_artifacts/prometheus_client_1643395600215/work
prompt-toolkit @ file:///tmp/build/80754af9/prompt-toolkit_1633440160888/work
protobuf==3.19.4
psutil @ file:///tmp/build/80754af9/psutil_1612298023621/work
ptyprocess @ file:///tmp/build/80754af9/ptyprocess_1609355006118/work/dist/ptyprocess-0.7.0-py2.py3-none-any.whl
pycparser @ file:///home/conda/feedstock_root/build_artifacts/pycparser_1636257122734/work
pycurl==7.44.1
Pygments @ file:///opt/conda/conda-bld/pygments_1644249106324/work
PyJWT @ file:///home/conda/feedstock_root/build_artifacts/pyjwt_1638819640841/work
pyOpenSSL @ file:///home/conda/feedstock_root/build_artifacts/pyopenssl_1643496850550/work
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pyrsistent @ file:///tmp/build/80754af9/pyrsistent_1636110947380/work
PySocks @ file:///home/conda/feedstock_root/build_artifacts/pysocks_1635862404924/work
python-dateutil @ file:///home/conda/feedstock_root/build_artifacts/python-dateutil_1626286286081/work
python-json-logger @ file:///home/conda/feedstock_root/build_artifacts/python-json-logger_1602545356084/work
pytz==2021.3
PyYAML==6.0
pyzmq @ file:///tmp/build/80754af9/pyzmq_1638436375034/work
ray==1.10.0
redis==4.1.4
requests @ file:///home/conda/feedstock_root/build_artifacts/requests_1641580202195/work
ruamel.yaml==0.16.5
ruamel.yaml.clib @ file:///opt/conda/conda-bld/ruamel.yaml.clib_1641552548372/work
Send2Trash @ file:///tmp/build/80754af9/send2trash_1632406701022/work
six @ file:///home/conda/feedstock_root/build_artifacts/six_1620240208055/work
sniffio @ file:///tmp/build/80754af9/sniffio_1614030475067/work
SQLAlchemy @ file:///home/conda/feedstock_root/build_artifacts/sqlalchemy_1612225077951/work
terminado @ file:///tmp/build/80754af9/terminado_1644322581811/work
testpath @ file:///tmp/build/80754af9/testpath_1624638946665/work
toolz==0.11.2
tornado @ file:///home/conda/feedstock_root/build_artifacts/tornado_1610094706440/work
traitlets @ file:///home/conda/feedstock_root/build_artifacts/traitlets_1635260543454/work
typing-extensions @ file:///tmp/build/80754af9/typing_extensions_1631814937681/work
urllib3 @ file:///home/conda/feedstock_root/build_artifacts/urllib3_1641584929973/work
wcwidth @ file:///Users/ktietz/demo/mc3/conda-bld/wcwidth_1629357192024/work
webencodings==0.5.1
websocket-client @ file:///tmp/build/80754af9/websocket-client_1614804261064/work
wrapt==1.13.3
zipp @ file:///home/conda/feedstock_root/build_artifacts/zipp_1643828507773/work
  • Configuration
c = get_config()
c.Spawner.mem_limit = '50G'
c.Spawner.mem_guarantee = '3G'
c.Spawner.cpu_limit = 50
c.Spawner.cpu_guarantee = 2

from subprocess import check_call
from hashlib import sha256
import pathlib, re, os, shutil, io


def pre_spawn_hook(spawner):
    """Create user:"""
    username = spawner.user.name
    username = username.strip()
    if username in ['root', 'ec2-user']:
        raise ValueError(f'Cannot create user "{username}"')
    uname_exp = re.compile("^([a-zA-Z0-9-]+)$")
    if uname_exp.match(username) is None:
        raise ValueError(f'"{username}" is an invalid alias')
    uid = int(sha256(str(username).encode('utf8')).hexdigest(), 16) % (4294967294-65536) + 65536  ## Ref: https://unix.stackexchange.com/a/685943
    try:
        check_call(['useradd', '-u', f'{uid}', '-ms', '/bin/bash', '-d', f'/efs/litmus-server/users/{username}', username])
    except Exception as e:
        print(f'{e}')
    """Create directory:"""
    username = spawner.user.name  # get the username
    volume_path = os.path.join('/efs/litmus-server/users', username)
    if not os.path.exists(volume_path):
        os.mkdir(volume_path, 0o755)
    volume_path = os.path.join('/efs', username)
    if not os.path.exists(volume_path):
        os.mkdir(volume_path, 0o755)
    os.system(f'chown -R {username} /efs/litmus-server/users/{username}/')


c.Spawner.pre_spawn_hook = pre_spawn_hook

c.Spawner.notebook_dir = '/efs/litmus-server/users/{username}/'

c.JupyterHub.port = 5432
c.Spawner.args = [
    '--allow-root',
]
c.ServerApp.shutdown_no_activity_timeout = 7 * 24 * 60 * 60
c.MappingKernelManager.cull_idle_timeout = 7 * 24 * 60 * 60  ## Ref: https://www.ibm.com/docs/en/spectrum-conductor/2.4.0?topic=notebooks-kernel-culling-jupyter
c.Spawner.default_url = '/lab'  ##Ref https://github.com/jupyterhub/jupyterhub/issues/2603#issuecomm$
c.MappingKernelManager.cull_idle_timeout = 24 * 60 * 60

c.JupyterHub.authenticator_class = 'firstuseauthenticator.FirstUseAuthenticator'
c.JupyterHub.template_paths=['./templates']  ## Ref: https://github.com/jupyterhub/jupyterhub/issues/1385#issuecomment-465801218
  • Logs
# paste relevant logs here, if any

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions