jupyterhub / the-littlest-jupyterhub

Simple JupyterHub distribution for 1-100 users on a single server
https://tljh.jupyter.org
BSD 3-Clause "New" or "Revised" License
1.02k stars 338 forks source link

Admin user login opening home directory of user created by jupyterhub #911

Open falconair opened 1 year ago

falconair commented 1 year ago

Bug description

Logging in as the admin user joe displays home directory of jupyter-joe rather than joe. Opening the terminal confirms that the working directory is /home/jupyter-joe rather than /home/joe

Expected behaviour

The admin user, passed in as part of the install command refers to an existing user joe. This user already had jupyterlab installed with many notebooks. In order to open up the server to other users, I installed jupyterhub and now logging in as joe doesn't show his home directory, therefore any of this files.

I would expected to log in as joe and see his existing directories. I would NOT expect to log in joe and see home directory belonging to jupyter-joe.

Actual behaviour

Logging in as joe takes m to jupyter-joe's home directory

How to reproduce

Iinstall TLJH according to instructions: curl -L https://tljh.jupyter.org/bootstrap.py | sudo -E python3 - --admin joe

After a few minutes, log in as joe

Your personal set up

the-littlest-jupyterhub

Full environment ``` _libgcc_mutex 0.1 conda_forge conda-forge _openmp_mutex 4.5 1_gnu conda-forge aiofiles 22.1.0 pypi_0 pypi aiosqlite 0.19.0 pypi_0 pypi alembic 1.11.1 pypi_0 pypi anyio 3.7.0 pypi_0 pypi argon2-cffi 21.3.0 pypi_0 pypi argon2-cffi-bindings 21.2.0 pypi_0 pypi arrow 1.2.3 pypi_0 pypi asttokens 2.2.1 pypi_0 pypi async-generator 1.10 pypi_0 pypi attrs 23.1.0 pypi_0 pypi babel 2.12.1 pypi_0 pypi backcall 0.2.0 pypi_0 pypi beautifulsoup4 4.12.2 pypi_0 pypi bleach 6.0.0 pypi_0 pypi brotlipy 0.7.0 py39h3811e60_1001 conda-forge bzip2 1.0.8 h7f98852_4 conda-forge c-ares 1.17.2 h7f98852_0 conda-forge ca-certificates 2023.5.7 hbcca054_0 conda-forge certifi 2023.5.7 pyhd8ed1ab_0 conda-forge certipy 0.1.3 pypi_0 pypi cffi 1.14.6 py39h4bc2ebd_1 conda-forge chardet 4.0.0 py39hf3d152e_1 conda-forge charset-normalizer 2.0.0 pyhd8ed1ab_0 conda-forge colorama 0.4.4 pyh9f0ad1d_0 conda-forge comm 0.1.3 pypi_0 pypi conda 4.10.3 py39hf3d152e_2 conda-forge conda-package-handling 1.7.3 py39h3811e60_0 conda-forge cryptography 3.4.8 py39hbca0aa6_0 conda-forge debugpy 1.6.7 pypi_0 pypi decorator 5.1.1 pypi_0 pypi defusedxml 0.7.1 pypi_0 pypi entrypoints 0.4 pypi_0 pypi exceptiongroup 1.1.1 pypi_0 pypi executing 1.2.0 pypi_0 pypi fastjsonschema 2.17.1 pypi_0 pypi fqdn 1.5.1 pypi_0 pypi greenlet 2.0.2 pypi_0 pypi icu 68.1 h58526e2_0 conda-forge idna 3.1 pyhd3deb0d_0 conda-forge importlib-metadata 6.6.0 pypi_0 pypi ipykernel 6.23.1 pypi_0 pypi ipython 8.13.2 pypi_0 pypi ipython-genutils 0.2.0 pypi_0 pypi ipywidgets 7.7.5 pypi_0 pypi isoduration 20.11.0 pypi_0 pypi jedi 0.18.2 pypi_0 pypi jinja2 3.1.2 pypi_0 pypi json5 0.9.14 pypi_0 pypi jsonpointer 2.3 pypi_0 pypi jsonschema 4.17.3 pypi_0 pypi jupyter-client 8.2.0 pypi_0 pypi jupyter-core 5.3.0 pypi_0 pypi jupyter-events 0.6.3 pypi_0 pypi jupyter-resource-usage 0.6.4 pypi_0 pypi jupyter-server 1.24.0 pypi_0 pypi jupyter-server-fileid 0.9.0 pypi_0 pypi jupyter-server-ydoc 0.8.0 pypi_0 pypi jupyter-telemetry 0.1.0 pypi_0 pypi jupyter-ydoc 0.2.4 pypi_0 pypi jupyterhub 1.5.1 pypi_0 pypi jupyterlab 3.6.4 pypi_0 pypi jupyterlab-pygments 0.2.2 pypi_0 pypi jupyterlab-server 2.22.1 pypi_0 pypi jupyterlab-widgets 1.1.4 pypi_0 pypi krb5 1.19.2 hcc1bbae_2 conda-forge ld_impl_linux-64 2.36.1 hea4e1c9_2 conda-forge libarchive 3.5.2 hccf745f_1 conda-forge libcurl 7.79.1 h2574ce0_1 conda-forge libedit 3.1.20191231 he28a2e2_2 conda-forge libev 4.33 h516909a_1 conda-forge libffi 3.4.2 h9c3ff4c_4 conda-forge libgcc-ng 12.2.0 h65d4601_19 conda-forge libgomp 12.2.0 h65d4601_19 conda-forge libiconv 1.16 h516909a_0 conda-forge libnghttp2 1.43.0 h812cca2_1 conda-forge libsolv 0.7.19 h780b84a_5 conda-forge libssh2 1.10.0 ha56f1ee_2 conda-forge libstdcxx-ng 11.2.0 he4da1e4_11 conda-forge libxml2 2.9.12 h72842e0_0 conda-forge libzlib 1.2.11 h36c2ea0_1013 conda-forge lz4-c 1.9.3 h9c3ff4c_1 conda-forge lzo 2.10 h516909a_1000 conda-forge mako 1.2.4 pypi_0 pypi mamba 0.16.0 py39h951de11_0 conda-forge markupsafe 2.1.2 pypi_0 pypi matplotlib-inline 0.1.6 pypi_0 pypi mistune 2.0.5 pypi_0 pypi nbclassic 1.0.0 pypi_0 pypi nbclient 0.8.0 pypi_0 pypi nbconvert 7.4.0 pypi_0 pypi nbformat 5.9.0 pypi_0 pypi nbgitpuller 1.1.1 pypi_0 pypi ncurses 6.2 h58526e2_4 conda-forge nest-asyncio 1.5.6 pypi_0 pypi notebook 6.5.4 pypi_0 pypi notebook-shim 0.2.3 pypi_0 pypi nteract-on-jupyter 2.1.3 pypi_0 pypi oauthlib 3.2.2 pypi_0 pypi openssl 1.1.1u hd590300_0 conda-forge packaging 23.1 pypi_0 pypi pamela 1.1.0 pypi_0 pypi pandocfilters 1.5.0 pypi_0 pypi parso 0.8.3 pypi_0 pypi pexpect 4.8.0 pypi_0 pypi pickleshare 0.7.5 pypi_0 pypi pip 21.3 pyhd8ed1ab_0 conda-forge platformdirs 3.5.1 pypi_0 pypi prometheus-client 0.17.0 pypi_0 pypi prompt-toolkit 3.0.38 pypi_0 pypi psutil 5.9.5 pypi_0 pypi ptyprocess 0.7.0 pypi_0 pypi pure-eval 0.2.2 pypi_0 pypi pycosat 0.6.3 py39h3811e60_1006 conda-forge pycparser 2.20 pyh9f0ad1d_2 conda-forge pygments 2.15.1 pypi_0 pypi pyopenssl 21.0.0 pyhd8ed1ab_0 conda-forge pyrsistent 0.19.3 pypi_0 pypi pysocks 1.7.1 py39hf3d152e_3 conda-forge python 3.9.7 hb7a2778_3_cpython conda-forge python-dateutil 2.8.2 pypi_0 pypi python-json-logger 2.0.7 pypi_0 pypi python_abi 3.9 2_cp39 conda-forge pyyaml 6.0 pypi_0 pypi pyzmq 25.1.0 pypi_0 pypi readline 8.1 h46c0cb4_0 conda-forge reproc 14.2.3 h7f98852_0 conda-forge reproc-cpp 14.2.3 h9c3ff4c_0 conda-forge requests 2.31.0 pypi_0 pypi rfc3339-validator 0.1.4 pypi_0 pypi rfc3986-validator 0.1.1 pypi_0 pypi ruamel-yaml 0.17.31 pypi_0 pypi ruamel-yaml-clib 0.2.7 pypi_0 pypi ruamel_yaml 0.15.80 py39h3811e60_1004 conda-forge send2trash 1.8.2 pypi_0 pypi setuptools 58.2.0 py39hf3d152e_0 conda-forge six 1.16.0 pyh6c4a22f_0 conda-forge sniffio 1.3.0 pypi_0 pypi soupsieve 2.4.1 pypi_0 pypi sqlalchemy 1.4.48 pypi_0 pypi sqlite 3.36.0 h9cd32fc_2 conda-forge stack-data 0.6.2 pypi_0 pypi terminado 0.17.1 pypi_0 pypi tinycss2 1.2.1 pypi_0 pypi tk 8.6.11 h27826a3_1 conda-forge tomli 2.0.1 pypi_0 pypi tornado 6.3.2 pypi_0 pypi tqdm 4.62.3 pyhd8ed1ab_0 conda-forge traitlets 5.9.0 pypi_0 pypi typing-extensions 4.6.3 pypi_0 pypi tzdata 2021c he74cb21_0 conda-forge uri-template 1.2.0 pypi_0 pypi urllib3 1.26.7 pyhd8ed1ab_0 conda-forge wcwidth 0.2.6 pypi_0 pypi webcolors 1.13 pypi_0 pypi webencodings 0.5.1 pypi_0 pypi websocket-client 1.5.2 pypi_0 pypi wheel 0.37.0 pyhd8ed1ab_1 conda-forge widgetsnbextension 3.6.4 pypi_0 pypi xz 5.2.5 h516909a_1 conda-forge y-py 0.5.9 pypi_0 pypi yaml 0.2.5 h516909a_0 conda-forge ypy-websocket 0.8.2 pypi_0 pypi zipp 3.15.0 pypi_0 pypi zlib 1.2.11 h36c2ea0_1013 conda-forge zstd 1.5.0 ha95c52a_0 conda-forge ```
Configuration ```python # jupyterhub_config.py ``` Everything is default, I made no changes. the jupyter_server_config.py has no uncommented lines
Logs ``` # paste relevant logs here, if any ```
welcome[bot] commented 1 year ago

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively. welcome You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada:

MridulS commented 1 year ago

This user already had jupyterlab installed with many notebooks. In order to open up the server to other users, I installed jupyterhub and now logging in as joe doesn't show his home directory, therefore any of this files.

I'm not sure if using the littlest jupyterhub would be right way for this. You can set up a vanilla jupyterhub with much more customization and control how it is setup. The littlest JupyterHub distribution by default has jupyter-{username} as system users https://tljh.jupyter.org/en/latest/topic/security.html#system-user-accounts, now if this bit should be admin customizable or not that's a different discussion.

consideRatio commented 1 year ago

I think I align with how @MridulS is reasoning here, but I've also run into this broken expectation in the past so I'd say it would be good if docs conveyed this better.

I wouldn't be comfortable suggesting or defaulting use of tljh to possibly directly influence and overlap with normal users on a machine. If a machine has the accounts root, docker, database-admin, joe etc, and an JupyterHub authenticator is configured - then the usernames on github overlaps with system usernames in a way that can be very wierd. All this complexity is avoided by prefixing jupyter- on the TLJH created system usernames, and I don't see a way to avoid doing that without introducing more risk than its worth.

gabrielecoppi commented 10 months ago

@consideRatio any possibility to give the user the option to drop the jupyter- prefix? I am currently using TLJH for my lab and it creates always confusion in the users having two users. At the moment I modified the code before installing and hardcoded removing the prefix. I am pretty relaxed in terms of security, since the hub is accessible only with a VPN