<commit_before># SudoSpawner

Enables [JupyterHub](https://github.com/jupyter/jupyterhub) to run without being root,
by spawning an intermediate process via `sudo`, which takes actions on behalf of the user.

The sudospawner mediator can only do two things:

1. signal processes via os.kill
2. spawn single-user servers

The only thing the Hub user needs sudo access for is launching the sudospawner script itself.

## setup

Install:

    pip install -e .

[Add sudo access to the script](https://github.com/jupyter/jupyterhub/wiki/Using-sudo-to-run-JupyterHub-without-root-privileges).

Tell JupyterHub to use SudoSpawner, by adding the following to your `jupyterhub_config.py`:

    c.JupyterHub.spawner_class='sudospawner.SudoSpawner'

## example

The Dockerfile in this repo contains an example config for setting up a JupyterHub system,
without any need to run anything as root.<commit_msg>Edit README for new user friendliness<commit_after># SudoSpawner

The SudoSpawner enables [JupyterHub](https://github.com/jupyter/jupyterhub)
to spawn single-user servers without being root, by spawning an intermediate
process via `sudo`, which takes actions on behalf of the user.

The ``sudospawner`` mediator, the intermediate process, can only do two things:

1. send a signal to another process using the os.kill() call
2. spawn single-user servers

Launching the ``sudospawner`` script is the only action that requires a
JupyterHub administrator to have ``sudo`` access to execute.

## Installation and setup

1. Install:

        pip install -e .

2. [Add sudo access to the script](https://github.com/jupyter/jupyterhub/wiki/Using-sudo-to-run-JupyterHub-without-root-privileges).

3. To configure JupyterHub to use SudoSpawner, add the following to your 
`jupyterhub_config.py`:

        c.JupyterHub.spawner_class='sudospawner.SudoSpawner'
    
   The [JupyterHub documentation](http://jupyterhub.readthedocs.org/en/latest/index.html)
   has additional information about [creating a configuration file](http://jupyterhub.readthedocs.org/en/latest/getting-started.html#how-to-configure-jupyterhub),
   if needed, and [recommended file locations for configuration files](http://jupyterhub.readthedocs.org/en/latest/getting-started.html#file-locations).

## Example

The [Dockerfile](https://github.com/jupyter/sudospawner/blob/master/Dockerfile) in this repo contains an example configuration for setting up a JupyterHub system,
without any need to run anything as root.
{'fraction_non_alphanumeric': 0.08613020622725434, 'fraction_numerical': 0.0028305701577031944, 'mean_word_length': 4.713625866050808, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 5, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3448236', 'n_tokens_mistral': 816, 'n_tokens_neox': 790, 'n_words': 255}