Running Jupyter in the background

5,001 views
Skip to first unread message

aurelien...@gmail.com

unread,
Dec 8, 2016, 12:49:00 AM12/8/16
to Project Jupyter
Hello,
I have been banging my head around the issue, how to run Jupyter in the background.
While using Jupyter you just enter jupyter notebook {possible options).
However I want to be able to access my server from anywhere to run some script in my webbrowser without having to keep my computer terminal open all the time. Or others to check some results on my notebook or do some test while I am sleep and and course I don't want to give them ssh access to my server so they can't run jupyter on the terminal.
Is there any daemon on linux that allow me to do that, like unicorn for ruby for example.
They say a lot about securing the server here:
And I found some interesting things about make it work with nginx, for example:
But nothing working.
Some ideas?
thanks.

Thomas Kluyver

unread,
Dec 8, 2016, 10:04:28 AM12/8/16
to Project Jupyter
On 8 December 2016 at 06:49, <aurelien...@gmail.com> wrote:
However I want to be able to access my server from anywhere to run some script in my webbrowser without having to keep my computer terminal open all the time. Or others to check some results on my notebook or do some test while I am sleep and and course I don't want to give them ssh access to my server so they can't run jupyter on the terminal.
Is there any daemon on linux that allow me to do that, like unicorn for ruby for example.

First: be aware that giving someone access to your notebook server is equivalent to giving them SSH access - they can run any code as your user account. So if you don't trust them enough to give them ssh access, don't give them notebook access!

I'm not sure exactly what you're asking for. The notebook server already runs as a web server, and the instructions you linked to should make it accessible from other computers. If you want to keep it running when you close your terminal, you can run it in a tool like 'screen' or 'nohup'. It would also be possible to configure it as a service, so it starts automatically when you start your computer, and keeps running until it's shut down.

Thomas

Jason Stedman

unread,
Dec 8, 2016, 6:43:15 PM12/8/16
to Project Jupyter
You might want to consider jupyterhub. It supports multiple users and can be configured to mount a shared volume through which you can share copies of your work. Also, as long as you don't run Docker as root it provides a slightly better safety margin.

Docker does raise the technical bar quite a bit, but as long as you run the hub container with the -d flag it runs in the background.

aurelien...@gmail.com

unread,
Dec 9, 2016, 11:21:35 AM12/9/16
to Project Jupyter
Thomas,
Thanks for your reply.
However I think we can do something about the user account. I created a user on my ubuntu server with very few write access. Just make them able to read the files I want on their session (after they can create as many python or other script on their ubuntu account but they are not root user so they can't do whatever they want). 
Actually make it run as service was an option I though about are you speaking about inserting something like that under ./etc/init.d/
description "jupyter"
start on runlevel
[xxxx]
stop on shutdown
respsawn
respawn limit 10 15
setuid myuser
setgid myuser
exec jupyter notebook --ip=x.x.x.x --port=XXXX
? I am not a linux expert.
For the rest I indeed already succeeded to make it accessible by other user with password on a web browser.
I didn't heard about nohup or screen so far, I will investigate on that, thanks for the info.
Aurelien

aurelien...@gmail.com

unread,
Dec 9, 2016, 11:24:25 AM12/9/16
to Project Jupyter
Thank you Jason,
That looks awesome, I will try it.
Aurelien

Thomas Kluyver

unread,
Dec 9, 2016, 12:01:45 PM12/9/16
to Project Jupyter
On 9 December 2016 at 17:21, <aurelien...@gmail.com> wrote:
However I think we can do something about the user account. I created a user on my ubuntu server with very few write access. Just make them able to read the files I want on their session (after they can create as many python or other script on their ubuntu account but they are not root user so they can't do whatever they want). 

That's probably a reasonable solution. Though you should still take some care, because the default on Linux is that users can read each other's files.

Actually make it run as service was an option I though about are you speaking about inserting something like that under ./etc/init.d/

Yes, that kind of thing. On recent versions of most Linux distros, I think it's easier to do this with a systemd service file. I'm not very familiar with this stuff either, but you can find examples in /usr/lib/systemd/system and /usr/lib/systemd/user .

Thomas
Reply all
Reply to author
Forward
0 new messages