# Does tmpauthenticator still work with TLJH?

**URL:** https://discourse.jupyter.org/t/does-tmpauthenticator-still-work-with-tljh/258
**Category:** The Littlest JupyterHub
**Created:** [December 10, 2018, 1:22am UTC](https://discourse.jupyter.org/t/does-tmpauthenticator-still-work-with-tljh/258 "2018-12-10T01:22:20Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![vaughnkoch](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/vaughnkoch/32/144_2.png) [@vaughnkoch](https://discourse.jupyter.org/u/vaughnkoch)
#### Post date: [December 10, 2018, 1:22am UTC](https://discourse.jupyter.org/t/does-tmpauthenticator-still-work-with-tljh/258/1 "2018-12-10T01:22:20Z")

</div>

Hi, I want to host a TLJH instance which lets me demo a custom Jupyter extension without users having to install it first. To do that, I want to use TLJH and have user accounts automatically created (and later destroyed), and also be able to send the user to an existing notebook automatically.

It looks like tmpauthenticator would work for that, but I’m getting errors when starting it.

> **[jupyterhub/tmpauthenticator](https://github.com/jupyterhub/tmpauthenticator)**
>
> JupyterHub authenticator that hands out temporary accounts for everyone. For use in tmpnb.org - jupyterhub/tmpauthenticator

This is how I installed it:

```auto
sudo -E pip install jupyterhub-tmpauthenticator
sudo tljh-config set auth.type tmpauthenticator.TmpAuthenticator
sudo tljh-config reload

```

However, once I installed it, the homepage (and other pages) just gave me this:

```auto
Service Unavailable

```

Here’s what the logs show:

```auto
Dec 10 01:11:12 li840-145 python3[10017]: [C 2018-12-10 01:11:12.901 JupyterHub application:90] Bad config encountered during initialization:
Dec 10 01:11:12 li840-145 python3[10017]: [C 2018-12-10 01:11:12.902 JupyterHub application:91] The 'authenticator_class' trait of < __main__.JupyterHub object at 0x7fbaece787f0> instance must be a type, but 'tmpauthenticator.TmpAuthenticator' could not be imported

```

I’m able to import tmpauthenticator here:

```auto
jupyter-vaughn@li840-145:~$ python
Python 3.6.5 |Anaconda, Inc.| (default, Apr 29 2018, 16:14:56)
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tmpauthenticator
>>> from tmpauthenticator import TmpAuthenticator

```

Do I need to install tmpauthenticator running as root on the machine directly? How do I make sure that I’m installing it for the right python instance that TLJH uses?

Thanks!

Vaughn

---

<div class="post-metadata">

### Author: ![yuvipanda](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/yuvipanda/32/17_2.png) [@yuvipanda](https://discourse.jupyter.org/u/yuvipanda)
#### Post date: [December 10, 2018, 5:17pm UTC](https://discourse.jupyter.org/t/does-tmpauthenticator-still-work-with-tljh/258/2 "2018-12-10T17:17:33Z")

</div>

Thanks for opening this!

TLJH sets up _two_ environments - a hub one and a user one. There’s some more details here: [http://tljh.jupyter.org/en/latest/contributing/packages.html](http://tljh.jupyter.org/en/latest/contributing/packages.html)

`python` and `pip` by default point to the user environment, rather than the hub one. If you instead use `sudo /opt/tljh/hub/bin/pip` instead to install tmpauthenticator, that should work fine.

We should probably also add tmpauthenticator the default TLJH install. A PR doing that would also be most welcome 🙂

---

<div class="post-metadata">

### Author: ![choldgraf](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/choldgraf/32/1264_2.png) [@choldgraf](https://discourse.jupyter.org/u/choldgraf)
#### Post date: [December 10, 2018, 5:51pm UTC](https://discourse.jupyter.org/t/does-tmpauthenticator-still-work-with-tljh/258/3 "2018-12-10T17:51:49Z")

</div>

> [@yuvipanda](#):
>
> We should probably also add tmpauthenticator the default TLJH install. A PR doing that would also be most welcome 🙂

Agree - this would be a nice use-case to show off. @vaughnkoch if you get this working and can either:

1. post the configuration / steps it took to get it working here
2. add a section to the authenticator section of the docs about this use-case

that’d be awesome 🙂

---

<div class="post-metadata">

### Author: ![vaughnkoch](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/vaughnkoch/32/144_2.png) [@vaughnkoch](https://discourse.jupyter.org/u/vaughnkoch)
#### Post date: [December 14, 2018, 2:24am UTC](https://discourse.jupyter.org/t/does-tmpauthenticator-still-work-with-tljh/258/4 "2018-12-14T02:24:37Z")

</div>

I’ll be happy to contribute this, but I won’t be able to do so for a few months. I’m in super crunch mode until end of March for a project I’m working on.

I did get tmpauthenticator up (thanks @yuvipanda !) and it works great. However, getting rid of old users takes a lot of effort. I found [culling](https://zero-to-jupyterhub.readthedocs.io/en/stable/user-management.html#culling-user-pods) on JupyterHub and tried these settings in config.yaml (with tljh-config reload of course)

```auto
cull:
  enabled: true
  every: 60
  timeout: 60

```

I also tried this to no avail:

```auto
cull:
  enabled: true

```

Does culling work for TLJH? I would expect it does since TLJH wraps JH, but maybe I missed something in the docs. Or, if culling is only for pods, is there equivalent functionality for inactive user accounts/servers for TLJH?

---

<div class="post-metadata">

### Author: ![choldgraf](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/choldgraf/32/1264_2.png) [@choldgraf](https://discourse.jupyter.org/u/choldgraf)
#### Post date: [December 14, 2018, 4:14pm UTC](https://discourse.jupyter.org/t/does-tmpauthenticator-still-work-with-tljh/258/5 "2018-12-14T16:14:12Z")

</div>

> [@vaughnkoch](#):
>
> Does culling work for TLJH?

hmmm that’s a good question, I didn’t see anything in the guide, but I agree it’d be good to have something about this here: [The Littlest JupyterHub — The Littlest JupyterHub documentation](http://tljh.jupyter.org/en/latest/index.html#administration-and-security)

---

<div class="post-metadata">

### Author: ![yuvipanda](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/yuvipanda/32/17_2.png) [@yuvipanda](https://discourse.jupyter.org/u/yuvipanda)
#### Post date: [December 18, 2018, 1:03am UTC](https://discourse.jupyter.org/t/does-tmpauthenticator-still-work-with-tljh/258/6 "2018-12-18T01:03:47Z")

</div>

Culling isn’t integrated into TLJH yet unfortunately. [https://github.com/jupyterhub/the-littlest-jupyterhub/issues/100](https://github.com/jupyterhub/the-littlest-jupyterhub/issues/100) has details.

[https://github.com/jupyterhub/jupyterhub/tree/master/examples/cull-idle](https://github.com/jupyterhub/jupyterhub/tree/master/examples/cull-idle) is the actual code that does the culling. the YAML format and link you found were for [Zero to JupyterHub](https://z2jh.jupyter.og), which is based on Kubernetes. Most of those don’t work with TLJH.
