Remote access to Jupyter lab
2 min read
This is going to be a checklist ie. do this, and you'll be fine.
preferably in a virtual environment.
$ jupyter server --generate-config $ jupyter server password Enter password:.... Verify password:...
This will create
Create a self signed certificate
openssl req -x509 -nodes -days 365 -newkey rsa:4096 -keyout mycert.pem -out mycert.pem
openssl will ask you a bunch of questions. The only important one is the FQDN. If you don't have one you can use your zero conf name (ie. yourmachinename.local) or your IP address (i think).
Store the resulting mycert.pem file wherever you want, really.
Now you've got two options.
- Create a shell script
- Use the generated jupyter_server_config.py
The shell variant
Create a shell script (remember to make it executable).
"*" \ --notebook-dir /path/to/notebook/dir \ --certfile=/path/to/mycert.pem \ --port=9999jupyter lab --no-browser --ip
For good measure you could add inn activation of your virtual env.
The config variant
There are a lot going on in that file. However, you'll will only have to add 5 lines.
In around a comment reading ## The full path to an SSL/TLS certificate file. add these lines:
c.ServerApp.certfile = '/absolute/path/to/mycert.pem' c.ServerApp.keyfile = '/absolute/path/to/mycert.pem' c.ServerApp.password = The hashed password found in jupyter_server_config.json c.ServerApp.ip = "*" c.ServerApp.open_browser = False c.ServerApp.port = 9999
Personally I prefer the script variant, mainly because I have no clue what's going on in the config file and if it should matter to me.
In either case, this will give you a jupyter instance to which you can connect remotely. The instance is password protected, and you will have to accept the SSL certificate (since it's self signed) in your browser before proceeding.
So.. there's that.